-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #281 from Turbo87/test-loader
Replace automatic test start via timeout with explicit `start()` call
- Loading branch information
Showing
6 changed files
with
69 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { describe, it } from 'mocha'; | ||
import AbstractTestLoader, { | ||
addModuleIncludeMatcher, | ||
} from 'ember-cli-test-loader/test-support/index'; | ||
|
||
addModuleIncludeMatcher(function(moduleName) { | ||
return moduleName.match(/\.jshint$/); | ||
}); | ||
|
||
export class TestLoader extends AbstractTestLoader { | ||
shouldLoadModule(moduleName) { | ||
return !moduleName.match(/^ember-mocha\//) | ||
&& (moduleName.match(/[-_]test$/) || moduleName.match(/\.jshint$/)); | ||
} | ||
|
||
moduleLoadFailure(moduleName, error) { | ||
describe('TestLoader Failures', function() { | ||
it(moduleName + ': could not be loaded', function() { | ||
throw error; | ||
}); | ||
}); | ||
} | ||
} | ||
|
||
/** | ||
* Load tests following the default patterns: | ||
* | ||
* - The module name ends with `-test` or `_test` | ||
* - The module name ends with `.jshint` | ||
*/ | ||
export function loadTests() { | ||
new TestLoader().loadModules(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import Application from '../app'; | ||
import config from '../config/environment'; | ||
import { setApplication } from '@ember/test-helpers'; | ||
import { start } from 'ember-mocha'; | ||
|
||
setApplication(Application.create(config.APP)); | ||
|
||
start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
import { setResolver } from 'ember-mocha'; | ||
import { setResolver, start } from 'ember-mocha'; | ||
import resolver from './helpers/resolver'; | ||
|
||
setResolver(resolver); | ||
|
||
start(); |
This file was deleted.
Oops, something went wrong.