Skip to content

Commit

Permalink
remove karma artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Maguire committed Feb 23, 2022
1 parent 7e716f7 commit 015ea9c
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 3,781 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run test:mocha
- run: npm run test:node
env:
CI: true
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"cwd": "${workspaceFolder}",
"runtimeExecutable": "node",
"runtimeArgs": ["--inspect-brk=9229", "node_modules/.bin/grunt", "test:mocha", "--test=${relativeFile}"],
"runtimeArgs": ["--inspect-brk=9229", "node_modules/.bin/grunt", "test:node", "--test=${relativeFile}"],
"port": 9229
}
]
Expand Down
34 changes: 5 additions & 29 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,29 @@

## Test suite

To run both the Mocha & Karma Browser tests, simply run the following command:
To run the Mocha tests, simply run the following command:

npm test

## Mocha Tests

Run the Mocha test suite

npm run test:mocha
npm run test:node

Or run just one or more test files

npm run test:mocha -- --test=spec/realtime/auth.test.js

## Browser Tests

Browser tests are run using [Karma test runner](http://karma-runner.github.io/0.12/index.html).

### To build & run the tests in a single step

npm run test:karma
npm run test:node -- --test=spec/realtime/auth.test.js

### Debugging the mocha tests locally with a debugger

Run the following command to launch tests with the debugger enabled. The tests will block until you attach a debugger.

node --inspect-brk=9229 node_modules/.bin/grunt test:mocha
node --inspect-brk=9229 node_modules/.bin/grunt test:node

Alternatively you can also run the tests for single file

node --inspect-brk=9229 node_modules/.bin/grunt test:mocha --test=test/spec/presence.test.js
node --inspect-brk=9229 node_modules/.bin/grunt test:node --test=test/spec/presence.test.js

The included vscode launch config allows you to launch and attach the debugger in one step, simply open the test
file you want to run and start debugging. Note that breakpoint setting for realtime code will be within the
Expand All @@ -77,22 +69,6 @@ Open your browser to [http://localhost:3000](http://localhost:3000). If you are

Note: If any files have been added or remove, running the task `npm run requirejs` will ensure all the necessary RequireJS dependencies are loaded into the browser by updating spec/support/browser_file_list.js

### Debugging the tests in your browser with Karma

If you would like to run the tests through Karma, then:

Start a Karma server

karma server

You can optionally connect your browser to the server, visit http://localhost:9876/

Click on the Debug button in the top right, and open your browser's debugging console.

Then run the tests against the Karma server. The `test:karma:run` command will concatenate the Ably files beforehand so any changes made in the source will be reflected in the test run.

npm run test:karma:run

### Testing environment variables for Node.js

All tests are run against the sandbox environment by default. However, the following environment variables can be set before running the Karma server to change the environment the tests are run against.
Expand Down
24 changes: 4 additions & 20 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,32 +122,16 @@ module.exports = function (grunt) {

grunt.loadTasks('spec/tasks');

var browsers = grunt.option('browsers') || 'default';
var optionsDescription = '\nOptions:\n --browsers [browsers] e.g. Chrome,PhantomJS (Firefox is default)';

grunt.registerTask('test',
'Concat files and run the entire test suite (Jasmine with node & Karma in a browser)' + optionsDescription,
['build', 'mocha', 'karma:' + browsers]
);

grunt.registerTask('test:karma',
'Run the Karma test suite' + optionsDescription,
['build', 'karma:' + browsers]
);

grunt.registerTask('test:karma:run',
'Concat files and then run the Karma test runner. Assumes a Karma server is running',
['build', 'requirejs', 'karma:run']
);

grunt.registerTask('test:mocha',
'Concat files and then run the Mocha specs\nOptions\n --test [tests] e.g. --test test/rest/auth.js',
grunt.registerTask('test', ['test:node']);
grunt.registerTask('test:node',
'Build the library and run the node test suite\nOptions\n --test [tests] e.g. --test test/rest/auth.js',
['build', 'mocha']
);

grunt.registerTask('test:webserver',
'Launch the Mocha test web server on http://localhost:3000/',
['build', 'checkGitSubmodules', 'requirejs', 'mocha:webserver']
['build', 'checkGitSubmodules', 'mocha:webserver']
);

grunt.registerTask('release:refresh-pkgVersion',
Expand Down
197 changes: 0 additions & 197 deletions karma.conf.js

This file was deleted.

Loading

0 comments on commit 015ea9c

Please sign in to comment.