UNPKG

1.92 kBJavaScriptView Raw
1// Load in our dependencies
2var assert = require('assert');
3
4// Start our tests
5// DEV: To test custom debug file, append the following config and `console.log's`
6// Then, run our standalone script: `TEST_TYPE=CUSTOM_CONTEXT_FILE npm run test-karma-continuous`
7// Then, click on "DEBUG" in the Electron window and view its console
8/*
9// Append to config
10config.set({
11 browsers: ['CustomElectron'],
12 customLaunchers: {
13 CustomElectron: {
14 base: 'Electron',
15 flags: ['--show']
16 }
17 }
18});
19
20// Add console.log's to this file
21console.log(__filename); // Should be `integration-test/test-files/custom-debug.html`
22console.log(__dirname); // Should be `integration-test/test-files/
23console.log(module); // Should have `filename: integration-test/test-files/custom-debug.html`
24*/
25describe('A karma configuration using a custom context file', function () {
26 // DEV: Determined exepctations via `../reference`
27 it('has the custom context file as its filename and dirname', function () {
28 // Example: /home/todd/github/karma-electron/test/integration-test/test-files/custom-context.html
29 assert(/test[\/\\]integration-test[\/\\]test-files[\/\\]custom-context\.html$/.test(__filename),
30 'Expected "' + __filename + '" to end with "test/integration-test/test-files/custom-context.html"');
31 // Example: /home/todd/github/karma-electron/test/integration-test/test-files
32 assert(/test[\/\\]integration-test[\/\\]test-files$/.test(__dirname),
33 'Expected "' + __dirname + '" to end with "test/integration-test/test-files"');
34 // Example: /home/todd/github/karma-electron/test/integration-test/test-files/custom-context.html
35 assert(/test[\/\\]integration-test[\/\\]test-files[\/\\]custom-context\.html$/.test(module.filename),
36 'Expected "' + module.filename + '" to end with "test/integration-test/test-files/custom-context.html"');
37 assert.strictEqual(module.id, '.');
38 });
39});