-
-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: backport package.json ignore on windows (#737)
Closes: #674
- Loading branch information
1 parent
13ade22
commit b4f7201
Showing
7 changed files
with
7,543 additions
and
7 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
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,81 @@ | ||
import path, { join } from 'path'; | ||
|
||
import { | ||
createWebpackDevServerDriver, | ||
WEBPACK_CLI_VERSION, | ||
WEBPACK_DEV_SERVER_VERSION, | ||
} from './sandbox/WebpackDevServerDriver'; | ||
import { createSandbox, Sandbox } from './sandbox/Sandbox'; | ||
import { readFixture } from './sandbox/Fixture'; | ||
import { FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION } from './sandbox/Plugin'; | ||
import { createGenericProcessDriver } from './sandbox/GenericProcessDriver'; | ||
|
||
describe('Webpack Inclusive Watcher', () => { | ||
let sandbox: Sandbox; | ||
|
||
beforeAll(async () => { | ||
sandbox = await createSandbox(); | ||
}); | ||
|
||
beforeEach(async () => { | ||
await sandbox.reset(); | ||
}); | ||
|
||
afterAll(async () => { | ||
await sandbox.cleanup(); | ||
}); | ||
|
||
it.each([{ async: false }, { async: true }])( | ||
'ignores package.json change for %p', | ||
async ({ async }) => { | ||
await sandbox.load([ | ||
await readFixture(path.join(__dirname, 'fixtures/environment/typescript-basic.fixture'), { | ||
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION: JSON.stringify( | ||
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION | ||
), | ||
TS_LOADER_VERSION: JSON.stringify('^7.0.0'), | ||
TYPESCRIPT_VERSION: JSON.stringify('4.6.3'), | ||
WEBPACK_VERSION: JSON.stringify('^5.0.0'), | ||
WEBPACK_CLI_VERSION: JSON.stringify(WEBPACK_CLI_VERSION), | ||
WEBPACK_DEV_SERVER_VERSION: JSON.stringify(WEBPACK_DEV_SERVER_VERSION), | ||
ASYNC: JSON.stringify(async), | ||
}), | ||
await readFixture(join(__dirname, 'fixtures/implementation/typescript-basic.fixture')), | ||
await readFixture( | ||
path.join(__dirname, 'fixtures/implementation/typescript-package.fixture') | ||
), | ||
]); | ||
|
||
// add import to typescript-nested-project project | ||
await sandbox.patch( | ||
'src/index.ts', | ||
"import { getUserName } from './model/User';", | ||
[ | ||
"import { getUserName } from './model/User';", | ||
'import { sayHello } from "../package";', | ||
'', | ||
"sayHello('World');", | ||
].join('\n') | ||
); | ||
|
||
// start webpack dev server | ||
const process = sandbox.spawn('npm run webpack-dev-server'); | ||
const baseDriver = createGenericProcessDriver(process); | ||
const webpackDriver = createWebpackDevServerDriver(process, async); | ||
|
||
await webpackDriver.waitForNoErrors(); | ||
|
||
// update nested package.json file | ||
await sandbox.patch('package/package.json', '"1.0.0"', '"1.0.1"'); | ||
|
||
// wait for 5 seconds and fail if there is Debug Failure. in the console output | ||
await expect(() => | ||
baseDriver.waitForStderrIncludes('Error: Debug Failure.', 5000) | ||
).rejects.toEqual( | ||
new Error('Exceeded time on waiting for "Error: Debug Failure." to appear in the stderr.') | ||
); | ||
|
||
await webpackDriver.waitForNoErrors(); | ||
} | ||
); | ||
}); |
23 changes: 23 additions & 0 deletions
23
test/e2e/fixtures/implementation/typescript-package.fixture
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,23 @@ | ||
/// package/package.json | ||
{ | ||
"name": "typescript-nested-project", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"main": "./index.js", | ||
"types": "./index.d.ts", | ||
"files": [ | ||
"./index.js" | ||
] | ||
} | ||
|
||
/// package/index.d.ts | ||
export declare function sayHello(who: string): string; | ||
|
||
/// package/index.js | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.sayHello = void 0; | ||
function sayHello(who) { | ||
return 'Hello ' + who + '!'; | ||
} | ||
exports.sayHello = sayHello; |
Oops, something went wrong.