From f5a372b075d633bc288019c8cd1b7b4c8a47f5ae Mon Sep 17 00:00:00 2001 From: David Majda Date: Thu, 8 Dec 2016 10:05:17 +0100 Subject: [PATCH] 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. --- CONTRIBUTING.md | 2 +- gulpfile.js | 20 +++++++++---------- {spec => test}/.eslintrc.json | 0 {spec => test}/README.md | 18 ++++++++--------- .../api/generated-parser-api.spec.js | 0 {spec => test}/api/pegjs-api.spec.js | 4 ++-- {spec => test}/api/plugin-api.spec.js | 0 .../generated-parser-behavior.spec.js | 2 +- {spec => test}/index.html | 0 {spec => test}/server | 4 ++-- .../compiler/passes/generate-bytecode.spec.js | 0 .../unit/compiler/passes/helpers.js | 0 .../passes/remove-proxy-rules.spec.js | 0 .../passes/report-duplicate-labels.spec.js | 0 .../passes/report-duplicate-rules.spec.js | 0 .../passes/report-infinite-recursion.spec.js | 0 .../passes/report-infinite-repetition.spec.js | 0 .../passes/report-undefined-rules.spec.js | 0 {spec => test}/unit/parser.spec.js | 2 +- {spec => test}/vendor/mocha/LICENSE | 0 {spec => test}/vendor/mocha/mocha.css | 0 {spec => test}/vendor/mocha/mocha.js | 0 22 files changed, 26 insertions(+), 26 deletions(-) rename {spec => test}/.eslintrc.json (100%) rename {spec => test}/README.md (67%) rename {spec => test}/api/generated-parser-api.spec.js (100%) rename {spec => test}/api/pegjs-api.spec.js (98%) rename {spec => test}/api/plugin-api.spec.js (100%) rename {spec => test}/behavior/generated-parser-behavior.spec.js (99%) rename {spec => test}/index.html (100%) rename {spec => test}/server (82%) rename {spec => test}/unit/compiler/passes/generate-bytecode.spec.js (100%) rename {spec => test}/unit/compiler/passes/helpers.js (100%) rename {spec => test}/unit/compiler/passes/remove-proxy-rules.spec.js (100%) rename {spec => test}/unit/compiler/passes/report-duplicate-labels.spec.js (100%) rename {spec => test}/unit/compiler/passes/report-duplicate-rules.spec.js (100%) rename {spec => test}/unit/compiler/passes/report-infinite-recursion.spec.js (100%) rename {spec => test}/unit/compiler/passes/report-infinite-repetition.spec.js (100%) rename {spec => test}/unit/compiler/passes/report-undefined-rules.spec.js (100%) rename {spec => test}/unit/parser.spec.js (99%) rename {spec => test}/vendor/mocha/LICENSE (100%) rename {spec => test}/vendor/mocha/mocha.css (100%) rename {spec => test}/vendor/mocha/mocha.js (100%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 07718c3..c0ebf80 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,7 +46,7 @@ see good examples. 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`). [issues]: https://github.com/pegjs/pegjs/issues diff --git a/gulpfile.js b/gulpfile.js index e429b2d..fbd5a5c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -32,9 +32,9 @@ const HEADER = [ const JS_FILES = [ "lib/**/*.js", "!lib/parser.js", - "spec/**/*.js", - "spec/server", - "!spec/vendor/**/*", + "test/**/*.js", + "test/server", + "!test/vendor/**/*", "benchmark/**/*.js", "benchmark/run", "benchmark/server", @@ -43,9 +43,9 @@ const JS_FILES = [ "gulpfile.js" ]; -const SPEC_FILES = [ - "spec/**/*.js", - "!spec/vendor/**/*" +const TEST_FILES = [ + "test/**/*.js", + "!test/vendor/**/*" ]; function generate(contents) { @@ -63,9 +63,9 @@ gulp.task("lint", () => .pipe(eslint.failAfterError()) ); -// Run specs. -gulp.task("spec", () => - gulp.src(SPEC_FILES, { read: false }) +// Run tests. +gulp.task("test", () => + gulp.src(TEST_FILES, { read: false }) .pipe(mocha()) ); @@ -104,5 +104,5 @@ gulp.task("parser", () => // Default task. gulp.task("default", cb => - runSequence("lint", "spec", cb) + runSequence("lint", "test", cb) ); diff --git a/spec/.eslintrc.json b/test/.eslintrc.json similarity index 100% rename from spec/.eslintrc.json rename to test/.eslintrc.json diff --git a/spec/README.md b/test/README.md similarity index 67% rename from spec/README.md rename to test/README.md index b9d96ff..4745955 100644 --- a/spec/README.md +++ b/test/README.md @@ -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. 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 ``` - 2. Execute the spec suite: + 2. Execute the test suite: ```console - $ gulp spec + $ gulp test ``` - 3. Watch the specs pass (or fail). + 3. Watch the tests pass (or fail). 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 ``` - 3. Serve the spec suite using a web server: + 3. Serve the test suite using a web server: ```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). diff --git a/spec/api/generated-parser-api.spec.js b/test/api/generated-parser-api.spec.js similarity index 100% rename from spec/api/generated-parser-api.spec.js rename to test/api/generated-parser-api.spec.js diff --git a/spec/api/pegjs-api.spec.js b/test/api/pegjs-api.spec.js similarity index 98% rename from spec/api/pegjs-api.spec.js rename to test/api/pegjs-api.spec.js index 704ba36..2a4a80c 100644 --- a/spec/api/pegjs-api.spec.js +++ b/test/api/pegjs-api.spec.js @@ -154,7 +154,7 @@ describe("PEG.js API", function() { }); // 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() { 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 // 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() { peg.generate("start = 'a'", { foo: 42 }); diff --git a/spec/api/plugin-api.spec.js b/test/api/plugin-api.spec.js similarity index 100% rename from spec/api/plugin-api.spec.js rename to test/api/plugin-api.spec.js diff --git a/spec/behavior/generated-parser-behavior.spec.js b/test/behavior/generated-parser-behavior.spec.js similarity index 99% rename from spec/behavior/generated-parser-behavior.spec.js rename to test/behavior/generated-parser-behavior.spec.js index adee86d..0ef1d56 100644 --- a/spec/behavior/generated-parser-behavior.spec.js +++ b/test/behavior/generated-parser-behavior.spec.js @@ -108,7 +108,7 @@ describe("generated parser behavior", function() { } // 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() { chai.use(helpers); }); diff --git a/spec/index.html b/test/index.html similarity index 100% rename from spec/index.html rename to test/index.html diff --git a/spec/server b/test/server similarity index 82% rename from spec/server rename to test/server index 39dcdde..c61690e 100755 --- a/spec/server +++ b/test/server @@ -4,8 +4,8 @@ /* eslint-env node */ -// Small server whose main purpose is to ensure that both the specced code and -// the specs get passed through Babel & Browserify before they are served to the +// Small server whose main purpose is to ensure that both the tested code and +// the tests get passed through Babel & Browserify before they are served to the // browser. let babelify = require("babelify"); diff --git a/spec/unit/compiler/passes/generate-bytecode.spec.js b/test/unit/compiler/passes/generate-bytecode.spec.js similarity index 100% rename from spec/unit/compiler/passes/generate-bytecode.spec.js rename to test/unit/compiler/passes/generate-bytecode.spec.js diff --git a/spec/unit/compiler/passes/helpers.js b/test/unit/compiler/passes/helpers.js similarity index 100% rename from spec/unit/compiler/passes/helpers.js rename to test/unit/compiler/passes/helpers.js diff --git a/spec/unit/compiler/passes/remove-proxy-rules.spec.js b/test/unit/compiler/passes/remove-proxy-rules.spec.js similarity index 100% rename from spec/unit/compiler/passes/remove-proxy-rules.spec.js rename to test/unit/compiler/passes/remove-proxy-rules.spec.js diff --git a/spec/unit/compiler/passes/report-duplicate-labels.spec.js b/test/unit/compiler/passes/report-duplicate-labels.spec.js similarity index 100% rename from spec/unit/compiler/passes/report-duplicate-labels.spec.js rename to test/unit/compiler/passes/report-duplicate-labels.spec.js diff --git a/spec/unit/compiler/passes/report-duplicate-rules.spec.js b/test/unit/compiler/passes/report-duplicate-rules.spec.js similarity index 100% rename from spec/unit/compiler/passes/report-duplicate-rules.spec.js rename to test/unit/compiler/passes/report-duplicate-rules.spec.js diff --git a/spec/unit/compiler/passes/report-infinite-recursion.spec.js b/test/unit/compiler/passes/report-infinite-recursion.spec.js similarity index 100% rename from spec/unit/compiler/passes/report-infinite-recursion.spec.js rename to test/unit/compiler/passes/report-infinite-recursion.spec.js diff --git a/spec/unit/compiler/passes/report-infinite-repetition.spec.js b/test/unit/compiler/passes/report-infinite-repetition.spec.js similarity index 100% rename from spec/unit/compiler/passes/report-infinite-repetition.spec.js rename to test/unit/compiler/passes/report-infinite-repetition.spec.js diff --git a/spec/unit/compiler/passes/report-undefined-rules.spec.js b/test/unit/compiler/passes/report-undefined-rules.spec.js similarity index 100% rename from spec/unit/compiler/passes/report-undefined-rules.spec.js rename to test/unit/compiler/passes/report-undefined-rules.spec.js diff --git a/spec/unit/parser.spec.js b/test/unit/parser.spec.js similarity index 99% rename from spec/unit/parser.spec.js rename to test/unit/parser.spec.js index 31bb473..f4955fb 100644 --- a/spec/unit/parser.spec.js +++ b/test/unit/parser.spec.js @@ -218,7 +218,7 @@ describe("PEG.js grammar parser", function() { // Helper activation needs to put inside a |beforeEach| block because the // helpers conflict with the ones in - // spec/behavior/generated-parser-behavior.spec.js. + // test/behavior/generated-parser-behavior.spec.js. beforeEach(function() { chai.use(helpers); }); diff --git a/spec/vendor/mocha/LICENSE b/test/vendor/mocha/LICENSE similarity index 100% rename from spec/vendor/mocha/LICENSE rename to test/vendor/mocha/LICENSE diff --git a/spec/vendor/mocha/mocha.css b/test/vendor/mocha/mocha.css similarity index 100% rename from spec/vendor/mocha/mocha.css rename to test/vendor/mocha/mocha.css diff --git a/spec/vendor/mocha/mocha.js b/test/vendor/mocha/mocha.js similarity index 100% rename from spec/vendor/mocha/mocha.js rename to test/vendor/mocha/mocha.js