Skip to content

Commit 5b9ea3f

Browse files
committed
fix _tmp file path
1 parent 26d9964 commit 5b9ea3f

File tree

5 files changed

+16
-17
lines changed

5 files changed

+16
-17
lines changed

lib/reducers/test-run/run.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function runTaskTests(setup) {
1010
var dir = store_1.default.getState().dir;
1111
var tutorialConfig = store_1.default.getState().tutorial.config;
1212
var output = parse_loaders_1.default(tests, tutorialConfig.testSuffix);
13-
var target = path_1.join(tutorialConfig.dir || dir, "_tmp." + tutorialConfig.testSuffix);
13+
var target = path_1.join(tutorialConfig.dir || dir, "_tmp" + tutorialConfig.testSuffix);
1414
fs_1.writeFileSync(target, output, 'utf8');
1515
var config = {
1616
dir: dir,

lib/reducers/tutorial/tutorial-config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ function tutorialConfig(tutorialPj) {
77
var config = tutorialPj.config, name = tutorialPj.name;
88
var repo = loadRepo(tutorialPj.repo);
99
var dir = store_1.default.getState().dir;
10+
var testSuffix = config.testSuffix;
1011
return {
1112
dir: path_1.join(dir, 'node_modules', name, config.dir),
12-
testSuffix: config.testSuffix || null,
13+
testSuffix: testSuffix.length && testSuffix[0] === '.'
14+
? testSuffix
15+
: '.' + testSuffix || null,
1316
runner: config.runner,
1417
runnerOptions: config.runnerOptions || null,
1518
run: loadRunner(name, config.runner, dir),

src/reducers/test-run/run.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function runTaskTests(setup?: boolean): boolean {
1515
// write temporary test file in tutorial directory
1616
let target = join(
1717
tutorialConfig.dir || dir,
18-
`_tmp.${tutorialConfig.testSuffix}`
18+
`_tmp${tutorialConfig.testSuffix}`
1919
);
2020
writeFileSync(target, output, 'utf8');
2121

src/reducers/tutorial/tutorial-config.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ import store from '../../store';
55

66
export function tutorialConfig(tutorialPj: PackageJson): Tutorial.Config {
77
const {config, name} = tutorialPj;
8-
const repo = loadRepo(tutorialPj.repo);
9-
const dir = store.getState().dir;
8+
const repo: string = loadRepo(tutorialPj.repo);
9+
const dir: string = store.getState().dir;
10+
const testSuffix: string = config.testSuffix;
1011
return {
11-
dir: join(
12-
dir, 'node_modules', name, config.dir
13-
),
14-
testSuffix: config.testSuffix || null,
12+
dir: join(dir, 'node_modules', name, config.dir),
13+
testSuffix: testSuffix.length && testSuffix[0] === '.'
14+
? testSuffix
15+
: '.' + testSuffix || null,
1516
runner: config.runner,
1617
runnerOptions: config.runnerOptions || null,
1718
run: loadRunner(name, config.runner, dir),
@@ -21,12 +22,7 @@ export function tutorialConfig(tutorialPj: PackageJson): Tutorial.Config {
2122
};
2223
}
2324

24-
// function getTestSuffix(suffix: string) {
25-
// console.log(suffix);
26-
// return suffix.substring(suffix.lastIndexOf('.') + 1, suffix.length);
27-
// }
28-
29-
function getIssuesPath(bugs?: {url: string}) {
25+
function getIssuesPath(bugs?: { url: string }) {
3026
return bugs && bugs.url ? bugs.url : null;
3127
}
3228

@@ -68,7 +64,7 @@ function loadRunner(name: string, runner: string, dir: string): () => any {
6864
}
6965
}
7066

71-
function loadRepo(repo?: {url: string}): string {
67+
function loadRepo(repo?: { url: string }): string {
7268
if (repo && repo.url) {
7369
let url: string = repo.url;
7470
if (!!url.match(/\.git$/)) {

src/typings/cr/tutorial.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ declare namespace Tutorial {
99
interface Config {
1010
dir: string;
1111
runner: string;
12-
runnerOptions?: RunnerOptions;
12+
runnerOptions?: Object;
1313
run: any;
1414
testSuffix?: string;
1515
issuesPath?: string;

0 commit comments

Comments
 (0)