Skip to content

Commit fba3c06

Browse files
authored
Fix generate_spec_json script. (#257)
* The tsconfig path was broken after the recent repo refactor. * We were accidentally leaving a .ts in the destination json file names. * I made it so the destination directory doesn't need to exist in advance.
1 parent e104359 commit fba3c06

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

packages/firestore/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"karma-sourcemap-loader": "^0.3.7",
3939
"karma-spec-reporter": "^0.0.31",
4040
"karma-webpack": "^2.0.4",
41+
"mkdirp": "^0.5.1",
4142
"mocha": "^3.5.0",
4243
"npm-run-all": "^4.1.1",
4344
"sinon": "^3.2.1",

packages/firestore/test/unit/generate_spec_json.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626
var glob = require('glob');
2727
var fs = require('fs');
28+
var mkdirp = require('mkdirp');
2829

2930
const describeSpec = require('./specs/describe_spec');
3031

@@ -52,17 +53,20 @@ function main(args) {
5253
return;
5354
}
5455
outputPath = args[2];
56+
mkdirp.sync(outputPath);
5557

5658
const testFiles = glob.sync('**/specs/*_spec.test.ts', { cwd: __dirname });
5759
if (testFiles.length === 0) {
5860
throw new Error('No test files found');
5961
}
6062
for (var i = 0; i < testFiles.length; ++i) {
61-
var specName = testFiles[i].replace(/\.js$/, '');
63+
var specName = testFiles[i].replace(/\.ts$/, '');
6264
var testName = specName.replace(/^specs\//, '');
6365
var filename = testName.replace(/[^A-Za-z\d]/g, '_') + '.json';
6466
writeToJSON(testFiles[i], outputPath + '/' + filename);
6567
}
68+
69+
console.log('JSON spec files successfully generated to:', outputPath);
6670
}
6771

6872
main(process.argv);

packages/firestore/test/unit/generate_spec_json.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ NPM_BIN_DIR="$(npm bin)"
2424
TSNODE="$NPM_BIN_DIR/ts-node"
2525
GENERATE_SPEC_JS="$DIR/generate_spec_json.js"
2626

27-
TS_NODE_PROJECT="$DIR/../../../tsconfig.test.json" $TSNODE $GENERATE_SPEC_JS "$@"
27+
TS_NODE_PROJECT="$DIR/../../tsconfig.json" $TSNODE $GENERATE_SPEC_JS "$@"

0 commit comments

Comments
 (0)