diff --git a/gulpfile.js b/gulpfile.js index 24fd4b2..66a8353 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -11,7 +11,7 @@ task( "lint", () => [ src( [ "**/.*rc.js", "packages/**/*.js", - "test/spec/**/*.js", + "test/**/*.js", "tools/**/*.js", "src/*.js", "rollup.config.js", @@ -24,13 +24,6 @@ task( "lint", () => [ ] ); -// Run tests. -task( "test", () => - - run( "node node_modules/mocha/bin/mocha test/spec/**/*.spec.js" ) - -); - // Generate the grammar parser. task( "build:parser", () => @@ -42,6 +35,3 @@ task( "build:parser", () => task( "clean", () => del( [ "packages/pegjs/dist", "website/js/*-bundle.js", "examples/*.js" ] ) ); - -// Default task. -task( "default", series( "lint", "test" ) ); diff --git a/package.json b/package.json index 410eb84..52b04f8 100644 --- a/package.json +++ b/package.json @@ -7,14 +7,14 @@ ], "scripts": { "lint": "gulp lint", - "spec": "gulp test", + "spec": "mocha --recursive", "benchmark": "benchmark", "build:parser": "gulp build:parser", "build:dist": "rollup -c", "clean": "gulp clean", "impact": "impact master", "start": "node server.js", - "test": "nyc gulp", + "test": "gulp lint && nyc mocha --recursive", "coverage": "nyc report --reporter=text-lcov | coveralls" }, "dependencies": { diff --git a/server.js b/server.js index dc23c28..9262f2b 100644 --- a/server.js +++ b/server.js @@ -134,7 +134,7 @@ babelOptions.runtimeHelpers = true; [ { name: "benchmark", input: "tools/benchmark/browser.js" }, - { name: "spec", input: "test/spec/**/*.js" }, + { name: "spec", input: "test/**/*.js" }, { name: "peg", input: "packages/pegjs/lib/peg.js", format: "umd" }, ].forEach( bundle => { diff --git a/test/README.md b/test/README.md deleted file mode 100644 index 32bc4b4..0000000 --- a/test/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# PEG.js Test Suites - -This directory contains various test suites and scripts to ensure PEG.js works correctly. - -* [Spec Suite](spec): Runs various test's that ensure PEG.js and it's generated parsers are working as intended. All tests should always pass on all supported platforms. -* [Benchmark Suite](benchmark): It measures speed of the parsers generated by PEG.js on various inputs. Its main goal is to provide data for code generator optimizations. -* [Impact Script](impact): Measures impact of a Git commit (or multiple commits) on generated parsers speed and size. - -## Download and Install - -To run the PEG.js test suites you most download the and install the module via the git repository: - - 1. Make sure you have Node.js and Git installed. - - 2. Download via Git and change the currently working directory: - - ```console - $ git clone https://github.com/pegjs/pegjs.git - $ cd pegjs - ``` - - 3. Install all dependencies, including the development dependencies: - - ```console - $ npm install - ``` - - 4. Install Gulp globally: - - ```console - $ npm install gulp -g - ``` - - 5. Processed... - - * [Running in Node.js](#running-in-nodejs) - * [Running in the Browser](#running-in-the-browser) - -## Running in Node.js - -The commands below need to be executed via the console from the PEG.js root directory (one level up from this one), after which they will output their results (if any). - - * Execute source code linting: - - ```console - $ gulp lint - ``` - - * Execute the spec test suite: - - ```console - $ gulp test - ``` - - * Execute the benchmark suite: - - ```console - $ gulp benchmark - ``` - - * Execute the impact suite: - - ```console - $ node test/impact - ``` - -## Running in the Browser - - * [Benchmark Suite](https://pegjs.org/benchmark) - * [Spec Suite](https://pegjs.org/spec) - -You also have the option of running the website locally by running `node server.js` or `npm start` from the root of this repository. After that just go to the development page and click the link `Benchmark Suite` or `Spec Suite`. diff --git a/test/spec/api/generated-parser-api.spec.js b/test/api/generated-parser-api.spec.js similarity index 100% rename from test/spec/api/generated-parser-api.spec.js rename to test/api/generated-parser-api.spec.js diff --git a/test/spec/api/pegjs-api.spec.js b/test/api/pegjs-api.spec.js similarity index 100% rename from test/spec/api/pegjs-api.spec.js rename to test/api/pegjs-api.spec.js diff --git a/test/spec/api/pegjs-util.spec.js b/test/api/pegjs-util.spec.js similarity index 100% rename from test/spec/api/pegjs-util.spec.js rename to test/api/pegjs-util.spec.js diff --git a/test/spec/api/plugin-api.spec.js b/test/api/plugin-api.spec.js similarity index 100% rename from test/spec/api/plugin-api.spec.js rename to test/api/plugin-api.spec.js diff --git a/test/spec/behavior/generated-parser-behavior.spec.js b/test/behavior/generated-parser-behavior.spec.js similarity index 100% rename from test/spec/behavior/generated-parser-behavior.spec.js rename to test/behavior/generated-parser-behavior.spec.js diff --git a/test/spec/unit/compiler/passes/generate-bytecode.spec.js b/test/unit/compiler/passes/generate-bytecode.spec.js similarity index 100% rename from test/spec/unit/compiler/passes/generate-bytecode.spec.js rename to test/unit/compiler/passes/generate-bytecode.spec.js diff --git a/test/spec/unit/compiler/passes/helpers.js b/test/unit/compiler/passes/helpers.js similarity index 100% rename from test/spec/unit/compiler/passes/helpers.js rename to test/unit/compiler/passes/helpers.js diff --git a/test/spec/unit/compiler/passes/inference-match-result.spec.js b/test/unit/compiler/passes/inference-match-result.spec.js similarity index 100% rename from test/spec/unit/compiler/passes/inference-match-result.spec.js rename to test/unit/compiler/passes/inference-match-result.spec.js diff --git a/test/spec/unit/compiler/passes/remove-proxy-rules.spec.js b/test/unit/compiler/passes/remove-proxy-rules.spec.js similarity index 100% rename from test/spec/unit/compiler/passes/remove-proxy-rules.spec.js rename to test/unit/compiler/passes/remove-proxy-rules.spec.js diff --git a/test/spec/unit/compiler/passes/report-duplicate-labels.spec.js b/test/unit/compiler/passes/report-duplicate-labels.spec.js similarity index 100% rename from test/spec/unit/compiler/passes/report-duplicate-labels.spec.js rename to test/unit/compiler/passes/report-duplicate-labels.spec.js diff --git a/test/spec/unit/compiler/passes/report-duplicate-rules.spec.js b/test/unit/compiler/passes/report-duplicate-rules.spec.js similarity index 100% rename from test/spec/unit/compiler/passes/report-duplicate-rules.spec.js rename to test/unit/compiler/passes/report-duplicate-rules.spec.js diff --git a/test/spec/unit/compiler/passes/report-incorrect-plucking.spec.js b/test/unit/compiler/passes/report-incorrect-plucking.spec.js similarity index 100% rename from test/spec/unit/compiler/passes/report-incorrect-plucking.spec.js rename to test/unit/compiler/passes/report-incorrect-plucking.spec.js diff --git a/test/spec/unit/compiler/passes/report-infinite-recursion.spec.js b/test/unit/compiler/passes/report-infinite-recursion.spec.js similarity index 100% rename from test/spec/unit/compiler/passes/report-infinite-recursion.spec.js rename to test/unit/compiler/passes/report-infinite-recursion.spec.js diff --git a/test/spec/unit/compiler/passes/report-infinite-repetition.spec.js b/test/unit/compiler/passes/report-infinite-repetition.spec.js similarity index 100% rename from test/spec/unit/compiler/passes/report-infinite-repetition.spec.js rename to test/unit/compiler/passes/report-infinite-repetition.spec.js diff --git a/test/spec/unit/compiler/passes/report-undefined-rules.spec.js b/test/unit/compiler/passes/report-undefined-rules.spec.js similarity index 100% rename from test/spec/unit/compiler/passes/report-undefined-rules.spec.js rename to test/unit/compiler/passes/report-undefined-rules.spec.js diff --git a/test/spec/unit/compiler/passes/report-unused-rules.spec.js b/test/unit/compiler/passes/report-unused-rules.spec.js similarity index 100% rename from test/spec/unit/compiler/passes/report-unused-rules.spec.js rename to test/unit/compiler/passes/report-unused-rules.spec.js diff --git a/test/spec/unit/parser.spec.js b/test/unit/parser.spec.js similarity index 100% rename from test/spec/unit/parser.spec.js rename to test/unit/parser.spec.js