-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix windows bugs & tests #1965
Fix windows bugs & tests #1965
Changes from 14 commits
c4d7802
c30d1df
85c8ef5
1bdeee1
ee0ac76
8aa7137
6e3f29a
2dfbcbe
817a6d6
6755adf
18ea3e6
355f225
e281a2c
7b1ddd1
1d4b4df
1644fb9
78f0318
415c79c
99b151d
327e88f
5b7f2b5
325c32f
f911eb5
60c43d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const isGlob = require('is-glob'); | ||
const fastGlob = require('fast-glob'); | ||
|
||
function normalisePath(p) { | ||
return p.replace(/\\/g, '/'); | ||
} | ||
|
||
exports.isGlob = function(p) { | ||
return isGlob(normalisePath(p)); | ||
}; | ||
|
||
exports.glob = function(p, options) { | ||
return fastGlob(normalisePath(p), options); | ||
}; | ||
|
||
exports.glob.sync = function(p, options) { | ||
return fastGlob.sync(normalisePath(p), options); | ||
}; |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const assert = require('assert'); | ||
const fs = require('../src/utils/fs'); | ||
const {bundle, assertBundleTree} = require('./utils'); | ||
const {bundle, assertBundleTree, normaliseNewlines} = require('./utils'); | ||
|
||
describe('pug', function() { | ||
it('should support bundling HTML', async function() { | ||
|
@@ -57,10 +57,14 @@ describe('pug', function() { | |
assets: ['index.pug'] | ||
}); | ||
|
||
const html = await fs.readFile(__dirname + '/dist/index.html', 'utf-8'); | ||
const expect = await fs.readFile( | ||
__dirname + '/integration/pug-include-extends/expect.html', | ||
'utf-8' | ||
const html = normaliseNewlines( | ||
await fs.readFile(__dirname + '/dist/index.html', 'utf-8') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why no |
||
); | ||
const expect = normaliseNewlines( | ||
await fs.readFile( | ||
__dirname + '/integration/pug-include-extends/expect.html', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also why no |
||
'utf-8' | ||
) | ||
); | ||
|
||
assert.equal(html, expect, 'Content mismatch'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,45 @@ | ||
const Resolver = require('../src/Resolver'); | ||
const path = require('path'); | ||
const assert = require('assert'); | ||
const {rimraf, ncp} = require('./utils'); | ||
const {mkdirp} = require('../src/utils/fs'); | ||
const {symlinkSync} = require('fs'); | ||
|
||
const rootDir = path.join(__dirname, 'integration', 'resolver'); | ||
const resolver = new Resolver({ | ||
rootDir, | ||
extensions: { | ||
'.js': true, | ||
'.json': true | ||
} | ||
}); | ||
const rootDir = path.join(__dirname, 'input/resolver'); | ||
|
||
describe('resolver', function() { | ||
let resolver; | ||
before(async function() { | ||
await rimraf(__dirname + '/input'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be replaced by |
||
await mkdirp(rootDir); | ||
await ncp(path.join(__dirname, 'integration/resolver'), rootDir); | ||
|
||
// Create the symlinks here to prevent cross platform and git issues | ||
symlinkSync( | ||
path.join(rootDir, 'packages/source'), | ||
path.join(rootDir, 'node_modules/source'), | ||
'dir' | ||
); | ||
symlinkSync( | ||
path.join(rootDir, 'packages/source-alias'), | ||
path.join(rootDir, 'node_modules/source-alias'), | ||
'dir' | ||
); | ||
symlinkSync( | ||
path.join(rootDir, 'packages/source-alias-glob'), | ||
path.join(rootDir, 'node_modules/source-alias-glob'), | ||
'dir' | ||
); | ||
|
||
resolver = new Resolver({ | ||
rootDir, | ||
extensions: { | ||
'.js': true, | ||
'.json': true | ||
} | ||
}); | ||
}); | ||
|
||
describe('file paths', function() { | ||
it('should resolve a relative path with an extension', async function() { | ||
let resolved = await resolver.resolve( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this even normalizes the filename?
This wouldn't do anything if it really is a node_module right?
some-module
=>some-module
some/sub/module/file.js
=>some/sub/module/file.js
I'll remove it for performance reasons. (and it doesn't fail any tests, it even fixes one on windows)