Skip to content

Commit

Permalink
Added automated testing of dist
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamkrishnar committed Aug 7, 2020
1 parent 45bceb5 commit 7db9484
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ node_js:
- 12
cache:
npm: true
jobs:
include:
- stage: Test generated dist
if: tag IS present
script: yarn run test-dist
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
"main": "blog-post-workflow.js",
"scripts": {
"start": "node blog-post-workflow.js",
"start-test": "node test.js",
"local-run": "start-server-and-test start-server http://localhost:8080 start-test",
"test-run": "npm run start-test && diff test/Readme.md test/Readme.md.snap",
"start-server": "node test/test-server.js",
"test-run": "node test.js && diff test/Readme.md test/Readme.md.snap",
"test": "npm run lint && start-server-and-test start-server http://localhost:8080 test-run",
"test-run-dist": "DIST=true node test.js && diff test/Readme.md test/Readme.md.snap",
"test-dist": "npm run lint && start-server-and-test start-server http://localhost:8080 test-run-dist",
"lint": "jshint --exclude='node_modules/' *.js",
"build": "parcel build --no-source-maps --target=node --bundle-node-modules blog-post-workflow.js"
},
Expand Down
4 changes: 3 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ fs.writeFile(path.join(__dirname, 'test', 'Readme.md'), template, () => {
process.env.INPUT_DISABLE_SORT = "false";
process.env.INPUT_TEMPLATE = "default";
process.env.TEST_MODE = "true";
require('./blog-post-workflow');
const testFile = process.env.DIST ? './dist/blog-post-workflow' :'./blog-post-workflow';
console.log('Testing: ', testFile);
require(testFile);
});

0 comments on commit 7db9484

Please sign in to comment.