Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(test): Add npm script to test with ts-node not caching #4065

Merged
merged 1 commit into from Aug 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -107,6 +107,7 @@ range(1, 200)

- `npm run build_all` - builds everything
- `npm test` - runs tests
- `npm run test_no_cache` - run test with `ts-node` set to false

`npm run info` will list available scripts (there are a lot LOL)

Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -91,6 +91,7 @@
"postpublish": "npm run tests2png && ./docs_app/scripts/publish-docs.sh",
"publish_docs": "./publish_docs.sh",
"test": "cross-env TS_NODE_PROJECT=spec/tsconfig.json mocha --opts spec/support/default.opts \"spec/**/*-spec.ts\"",
"test_no_cache": "cross-env TS_NODE_PROJECT=spec/tsconfig.json TS_NODE_CACHE=false mocha --opts spec/support/default.opts \"spec/**/*-spec.ts\"",
"test_transpile_only": "cross-env TS_NODE_PROJECT=spec/tsconfig.json TS_NODE_TRANSPILE_ONLY=true mocha --opts spec/support/default.opts \"spec/**/*-spec.ts\"",
"test:browser": "echo \"Browser test is not working currently\" && exit -1 && npm-run-all build:spec:browser && opn spec/support/mocha-browser-runner.html",
"test:cover": "nyc npm test",
Expand Down
3 changes: 2 additions & 1 deletion spec/migration/update-6_0_0/index-spec.ts
Expand Up @@ -13,11 +13,12 @@ describe('Migration Schematic', () => {
tree.create('/package.json', `{}`);
});

it('adds missing dependencies', () => {
it('adds missing dependencies', (done) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the done here really needed? Is there a particular reason for adding it? It seems superfluous.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cartant Sorry, should have commented on that. When I added the script and ran npm run test_no_cache, the test failed with a timeout without having the done.

const runner = new SchematicTestRunner('schematics', collectionPath);
tree = runner.runSchematic('rxjs-migration-01', {}, tree);

const pkg = JSON.parse(tree.readContent('/package.json'));
expect(pkg.dependencies['rxjs-compat']).to.equal('^6.0.0-rc.0');
done();
});
});