Skip to content
Permalink
Browse files

add testing for the Procfile (#2174)

  • Loading branch information...
Pomax committed Nov 14, 2018
1 parent 16a634f commit ed169f1006634e67d91b1d1eaee985795b6e7e62
Showing with 17 additions and 1 deletion.
  1. +2 −1 package.json
  2. +15 −0 test/test-procfile.js
@@ -23,9 +23,10 @@
"server": "pipenv run python network-api/manage.py runserver",
"start": "npm i && npm run build-uncompressed && run-p server watch:**",
"snyk": "snyk test --file=package.json",
"test:procfile": "node test/test-procfile.js",
"test:eslint": "eslint --config ./.eslintrc.yaml \"source/js/**/*.js\" \"source/js/**/*.jsx\" webpack.config.js",
"test:scss": "stylelint \"source/sass/**/*.scss\" \"source/js/**/*.scss\" --syntax scss",
"test": "npm run build && run-s test:**",
"test": "run-s test:** build",
"watch:images": "chokidar \"source/images/**/*\" -c \"npm run build:images\"",
"watch:js": "chokidar \"source/js/**/*.js\" \"source/js/**/*.jsx\" -c \"npm run build:js-uncompressed\"",
"watch:sass": "chokidar \"source/**/*.scss\" -c \"npm run build:sass\""
@@ -0,0 +1,15 @@
let fs = require(`fs`);
let path = require(`path`);
let lines = fs.readFileSync(path.join(__dirname,`..`,`Procfile`))
.toString()
.split(`\n`);

// A valid Procfile consists only of lines that start with
// "keyword: ...", where the keyword arguments cannot be spread
// over multiple lines, so we can test the start of every line
// for that {keyword, colon} presence:
let re = /^\w+:\s+/;
let passes = lines.every(l => (!l || l.match(re)));

// make sure to exit this script with the correct code:
process.exit(passes ? 0 : 1);

0 comments on commit ed169f1

Please sign in to comment.
You can’t perform that action at this time.