Skip to content

Commit

Permalink
Fix Windows build and tests
Browse files Browse the repository at this point in the history
Resolves #929, Resolves #934
  • Loading branch information
bryanforbes authored and jason0x43 committed Jul 3, 2018
1 parent b3d9abf commit 8110cee
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 12 deletions.
27 changes: 26 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
"devpack": "intern-dev-build && cd _build/src && npm pack && cp *.tgz ../../",
"clean": "intern-dev-clean",
"lint": "intern-dev-lint",
"release": "INTERN_BUILD=release intern-dev-release",
"start": "NODE_PATH=_build node _tests/src/bin/intern.js serveOnly",
"test": "NODE_PATH=_build node _tests/src/bin/intern.js",
"release": "cross-env INTERN_BUILD=release intern-dev-release",
"start": "cross-env NODE_PATH=_build node _tests/src/bin/intern.js serveOnly",
"test": "cross-env NODE_PATH=_build node _tests/src/bin/intern.js",
"preci": "intern-dev-build",
"ci": "npm test config=@ci",
"watch": "intern-dev-build watch",
Expand Down Expand Up @@ -124,6 +124,7 @@
"@types/webpack": "~4.1.3",
"ajv": "~6.4.0",
"concurrently": "~3.5.0",
"cross-env": "~5.2.0",
"css-loader": "~0.28.11",
"jsdom": "~11.8.0",
"lint-staged": "~7.0.5",
Expand Down Expand Up @@ -180,4 +181,4 @@
]
},
"pre-commit": "precommit"
}
}
14 changes: 9 additions & 5 deletions tests/unit/lib/middleware/instrument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import {
createMockServerContext
} from '../../../support/unit/mocks';
import { mockFs, mockPath, MockStats } from '../../../support/unit/nodeMocks';
import { normalize } from 'path';

const mockRequire = <mocking.MockRequire>intern.getPlugin('mockRequire');
const testPath = normalize('/base/foo/thing.js');

registerSuite('lib/middleware/instrument', function() {
let instrument: typeof _instrument;
Expand Down Expand Up @@ -47,7 +49,10 @@ registerSuite('lib/middleware/instrument', function() {

beforeEach() {
fs.__fileData = {
'/base/foo/thing.js': { type: 'file', data: 'what a fun time' }
[testPath]: {
type: 'file',
data: 'what a fun time'
}
};
server = createMockServer({
basePath: '/base',
Expand Down Expand Up @@ -107,7 +112,7 @@ registerSuite('lib/middleware/instrument', function() {
},

directory() {
fs.__fileData['/base/foo/thing.js']!.type = 'directory';
fs.__fileData[testPath]!.type = 'directory';

handler(request, response, next);

Expand All @@ -120,9 +125,8 @@ registerSuite('lib/middleware/instrument', function() {
sandbox
.stub(fs, 'stat')
.callsFake((path: string, callback: any) => {
const data =
fs.__fileData['/base/foo/thing.js'];
fs.__fileData['/base/foo/thing.js'] = undefined;
const data = fs.__fileData[testPath];
fs.__fileData[testPath] = undefined;
callback(
undefined,
new MockStats(path, data!.type)
Expand Down
4 changes: 2 additions & 2 deletions webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const common: Configuration = {
module: {
rules: [
{
test: /@dojo\//,
test: /@dojo[\\\/]/,
use: 'umd-compat-loader'
},
{
Expand All @@ -29,7 +29,7 @@ const common: Configuration = {
}
}
],
noParse: /benchmark\/benchmark.js/
noParse: /benchmark[\\\/]benchmark.js/
},
performance: {
// Hides a warning about large bundles.
Expand Down

0 comments on commit 8110cee

Please sign in to comment.