Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

Commit

Permalink
Browser unit tests by using custom intern loader
Browse files Browse the repository at this point in the history
  • Loading branch information
rorticus committed Sep 8, 2017
1 parent 9b98e42 commit d06b96b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 65 deletions.
45 changes: 0 additions & 45 deletions src/tslib.ts

This file was deleted.

15 changes: 2 additions & 13 deletions tests/intern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,11 @@ export const capabilities = {
export const maxConcurrency = 5;

export const browser = {
require: [
'./node_modules/@dojo/loader/loader.js',
'./_build/src/util/amd.js',
'./_build/tests/loader.js',
'./_build/src/main.js'
]
};

export const node = {
require: [
'./_build/src/main.js'
]
loader: './_build/tests/loader.js'
};

// Non-functional test suite(s) to run in each browser
export const suites = ['_build/tests/unit/all.js'];
export const suites = ['_build/src/main.js', '_build/tests/unit/all.js'];

// Functional test suite(s) to run in each browser once non-functional tests are completed
export const functionalSuites = '_build/tests/functional/all';
Expand Down
23 changes: 16 additions & 7 deletions tests/loader.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
(<any> require).config(shimAmdDependencies({
packages: [
{ name: 'src', location: '_build/src' },
{ name: 'tests', location: '_build/tests' },
{ name: 'dojo', location: 'node_modules/intern/node_modules/dojo' }
]
}));
intern.registerLoader((options) => {
return intern.loadScript('node_modules/@dojo/loader/loader.js')
.then(() => intern.loadScript('./_build/src/util/amd.js'))
.then(() => {
(<any> require).config(shimAmdDependencies({
baseUrl: options.baseUrl || intern.config.basePath,
packages: []
}));

return (modules: string[]) => {
return new Promise<void>((resolve, reject) => {
(<any> require)(modules, () => resolve());
});
};
});
});

0 comments on commit d06b96b

Please sign in to comment.