Use "test" and "tests" instead of "spec" and "specs"

This reflects a convention used in most JavaScript projects. The change
involves renaming the "spec" directory, Gulp task, etc.
redux
David Majda 8 years ago
parent 73de2c9384
commit f5a372b075

@ -46,7 +46,7 @@ see good examples.
When appropriate, add documentation and tests. When appropriate, add documentation and tests.
Before submitting, make sure your change passes the specs (`gulp spec`) and Before submitting, make sure your change passes the tests (`gulp test`) and
ESLint checks (`gulp lint`). ESLint checks (`gulp lint`).
[issues]: https://github.com/pegjs/pegjs/issues [issues]: https://github.com/pegjs/pegjs/issues

@ -32,9 +32,9 @@ const HEADER = [
const JS_FILES = [ const JS_FILES = [
"lib/**/*.js", "lib/**/*.js",
"!lib/parser.js", "!lib/parser.js",
"spec/**/*.js", "test/**/*.js",
"spec/server", "test/server",
"!spec/vendor/**/*", "!test/vendor/**/*",
"benchmark/**/*.js", "benchmark/**/*.js",
"benchmark/run", "benchmark/run",
"benchmark/server", "benchmark/server",
@ -43,9 +43,9 @@ const JS_FILES = [
"gulpfile.js" "gulpfile.js"
]; ];
const SPEC_FILES = [ const TEST_FILES = [
"spec/**/*.js", "test/**/*.js",
"!spec/vendor/**/*" "!test/vendor/**/*"
]; ];
function generate(contents) { function generate(contents) {
@ -63,9 +63,9 @@ gulp.task("lint", () =>
.pipe(eslint.failAfterError()) .pipe(eslint.failAfterError())
); );
// Run specs. // Run tests.
gulp.task("spec", () => gulp.task("test", () =>
gulp.src(SPEC_FILES, { read: false }) gulp.src(TEST_FILES, { read: false })
.pipe(mocha()) .pipe(mocha())
); );
@ -104,5 +104,5 @@ gulp.task("parser", () =>
// Default task. // Default task.
gulp.task("default", cb => gulp.task("default", cb =>
runSequence("lint", "spec", cb) runSequence("lint", "test", cb)
); );

@ -1,7 +1,7 @@
PEG.js Spec Suite PEG.js Test Suite
================= =================
This is the PEG.js spec suite. It ensures PEG.js works correctly. All specs This is the PEG.js test suite. It ensures PEG.js works correctly. All tests
should always pass on all supported platforms. should always pass on all supported platforms.
Running in Node.js Running in Node.js
@ -16,13 +16,13 @@ All commands in the following steps need to be executed in PEG.js root directory
$ npm install $ npm install
``` ```
2. Execute the spec suite: 2. Execute the test suite:
```console ```console
$ gulp spec $ gulp test
``` ```
3. Watch the specs pass (or fail). 3. Watch the tests pass (or fail).
Running in the Browser Running in the Browser
---------------------- ----------------------
@ -38,12 +38,12 @@ All commands in the following steps need to be executed in PEG.js root directory
$ npm install $ npm install
``` ```
3. Serve the spec suite using a web server: 3. Serve the test suite using a web server:
```console ```console
$ spec/server $ test/server
``` ```
4. Point your browser to the [spec suite](http://localhost:8000/). 4. Point your browser to the [test suite](http://localhost:8000/).
5. Watch the specs pass (or fail). 5. Watch the tests pass (or fail).

@ -154,7 +154,7 @@ describe("PEG.js API", function() {
}); });
// The |optimize| option isn't tested because there is no meaningful way to // The |optimize| option isn't tested because there is no meaningful way to
// write the specs without turning this into a performance test. // write the tests without turning this into a performance test.
describe("output", function() { describe("output", function() {
let grammar = "start = 'a'"; let grammar = "start = 'a'";
@ -191,7 +191,7 @@ describe("PEG.js API", function() {
// becasue there is no meaningful way to thest their effects without turning // becasue there is no meaningful way to thest their effects without turning
// this into an integration test. // this into an integration test.
// The |plugins| option is tested in plugin API specs. // The |plugins| option is tested in plugin API tests.
it("accepts custom options", function() { it("accepts custom options", function() {
peg.generate("start = 'a'", { foo: 42 }); peg.generate("start = 'a'", { foo: 42 });

@ -108,7 +108,7 @@ describe("generated parser behavior", function() {
} }
// Helper activation needs to put inside a |beforeEach| block because the // Helper activation needs to put inside a |beforeEach| block because the
// helpers conflict with the ones in spec/unit/parser.spec.js. // helpers conflict with the ones in test/unit/parser.spec.js.
beforeEach(function() { beforeEach(function() {
chai.use(helpers); chai.use(helpers);
}); });

@ -4,8 +4,8 @@
/* eslint-env node */ /* eslint-env node */
// Small server whose main purpose is to ensure that both the specced code and // Small server whose main purpose is to ensure that both the tested code and
// the specs get passed through Babel & Browserify before they are served to the // the tests get passed through Babel & Browserify before they are served to the
// browser. // browser.
let babelify = require("babelify"); let babelify = require("babelify");

@ -218,7 +218,7 @@ describe("PEG.js grammar parser", function() {
// Helper activation needs to put inside a |beforeEach| block because the // Helper activation needs to put inside a |beforeEach| block because the
// helpers conflict with the ones in // helpers conflict with the ones in
// spec/behavior/generated-parser-behavior.spec.js. // test/behavior/generated-parser-behavior.spec.js.
beforeEach(function() { beforeEach(function() {
chai.use(helpers); chai.use(helpers);
}); });
Loading…
Cancel
Save