Skip to content

Commit b57c0ab

Browse files
committed
rename back to concat-tests
1 parent 1355b82 commit b57c0ab

File tree

6 files changed

+12
-16
lines changed

6 files changed

+12
-16
lines changed

lib/reducers/run-tests/parse-loaders.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
var path = require('path');
33
var fs = require('fs');
44
var supportedFileTypes = ['js', 'jsx', 'ts', 'py'];
5-
var js = /^\/\/\s?load\(['"`](.+)['"`]\)$/;
5+
var js = /^\/\/\s?load\(['"`](.+)['"`]\)$/m;
66
var loaderMatch = {
77
js: js,
88
ts: js,
99
jsx: js,
10-
py: /\#\s?load\(['"`](.+)['"`]\)$/
10+
py: /^#\s?load\(['"`](.+)['"`]\)$/m
1111
};
1212
function parseLoaders(data, fileType) {
1313
if (supportedFileTypes.indexOf(fileType) < 0) {
1414
console.log("File type \"" + fileType + "\" not supported.");
1515
return '';
1616
}
1717
var imports = '';
18-
var i = 0;
18+
var i = -1;
1919
var lines = data.split('\n');
2020
while (i < lines.length - 1) {
2121
i += 1;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "atom-coderoad",
33
"main": "./lib/atom/main",
4-
"version": "0.5.7",
4+
"version": "0.6.0",
55
"description": "Interactive tutorial plugin for Atom",
66
"author": "Shawn McKay <shawn.j.mckay@gmail.com>",
77
"keywords": [

src/reducers/run-tests/parse-loaders.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import * as path from 'path';
22
import * as fs from 'fs';
33

44
const supportedFileTypes = ['js', 'jsx', 'ts', 'py'];
5-
const js = /^\/\/\s?load\(['"`](.+)['"`]\)$/;
5+
const js = /^\/\/\s?load\(['"`](.+)['"`]\)$/m;
66
const loaderMatch = {
77
js, // // load('file'),
88
ts: js,
99
jsx: js,
10-
py: /\#\s?load\(['"`](.+)['"`]\)$/ // # load('file')
10+
py: /^#\s?load\(['"`](.+)['"`]\)$/m // # load('file')
1111
};
1212

1313
export default function parseLoaders(data: string, fileType: string) {
@@ -19,7 +19,7 @@ export default function parseLoaders(data: string, fileType: string) {
1919

2020
let imports = '';
2121
// loop over lines and add editor files
22-
let i = 0;
22+
let i = -1;
2323
let lines = data.split('\n');
2424

2525
while (i < lines.length - 1) {

src/reducers/task-tests/loader.ts renamed to src/reducers/task-tests/concat-tests.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function readAppend(targetFile: string, file: string): boolean {
2020
}
2121
}
2222

23-
function concatTests(targetFile: string, files: any): string {
23+
export default function concatTests(targetFile: string, files: any): string {
2424
// delete previous file
2525
unlink(targetFile).then(() => {
2626
// load tests in order
@@ -33,7 +33,3 @@ function concatTests(targetFile: string, files: any): string {
3333
});
3434
return;
3535
}
36-
37-
export default function load(targetFile: string, files: any) {
38-
concatTests(targetFile, files);
39-
}

src/reducers/task-tests/task-tests.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
'use strict';
21
import * as path from 'path';
2+
import * as fs from 'fs';
33
import * as Type from '../../actions/actionTypes';
4-
import load from './loader';
4+
import concatTests from './concat-tests';
55

66
export default function taskTestsReducer(taskTests = '', action: CR.Action): string {
77
switch (action.type) {
88
case Type.SET_PAGE:
99
let target = path.join(window.coderoad.tutorialDir || window.coderoad.dir, `_tmpTests${window.coderoad.suffix}`);
10-
load(target, action.payload.taskTests);
10+
concatTests(target, action.payload.taskTests);
1111
return target;
1212
default:
1313
return taskTests;

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"src/reducers/run-tests/run.ts",
8585
"src/reducers/run-tests/test-result.ts",
8686
"src/reducers/task-position/task-position.ts",
87-
"src/reducers/task-tests/loader.ts",
87+
"src/reducers/task-tests/concat-tests.ts",
8888
"src/reducers/task-tests/task-tests.ts",
8989
"src/reducers/tasks/tasks.ts",
9090
"src/reducers/tutorials/tutorials.ts",

0 commit comments

Comments
 (0)