From 5f7e76aaa1cf2c90c43262f7e6a91c2507796b58 Mon Sep 17 00:00:00 2001 From: Anshuman Verma Date: Fri, 8 Jan 2021 23:51:16 +0530 Subject: [PATCH] fix: tests --- test/entry/flag-entry/entry-with-flag.test.js | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/test/entry/flag-entry/entry-with-flag.test.js b/test/entry/flag-entry/entry-with-flag.test.js index 22d0ff09f95..1d0df4f63d7 100644 --- a/test/entry/flag-entry/entry-with-flag.test.js +++ b/test/entry/flag-entry/entry-with-flag.test.js @@ -1,6 +1,6 @@ 'use strict'; -const { run, isWebpack5 } = require('../../utils/test-utils'); +const { run } = require('../../utils/test-utils'); const { existsSync, readFile } = require('fs'); const { resolve } = require('path'); @@ -23,23 +23,15 @@ describe('entry flag', () => { it('should resolve the path to /src/a.js as ./src/a.js for webpack-5 only', (done) => { const { exitCode, stderr, stdout } = run(__dirname, ['--entry', '/src/a.js']); - - if (!isWebpack5) { - expect(exitCode).toBe(1); - expect(stderr).toBeFalsy(); - expect(stdout).toContain(`Module not found: Error: Can't resolve`); + expect(exitCode).toBe(0); + expect(stderr).toBeFalsy(); + expect(stdout).toBeTruthy(); + expect(existsSync(resolve(__dirname, './dist/main.js'))).toBeTruthy(); + readFile(resolve(__dirname, './bin/main.js'), 'utf-8', (err, data) => { + expect(err).toBe(null); + expect(data).toContain('Hello from a.js'); done(); - } else { - expect(exitCode).toBe(0); - expect(stderr).toBeFalsy(); - expect(stdout).toBeTruthy(); - expect(existsSync(resolve(__dirname, './dist/main.js'))).toBeTruthy(); - readFile(resolve(__dirname, './bin/main.js'), 'utf-8', (err, data) => { - expect(err).toBe(null); - expect(data).toContain('Hello from a.js'); - done(); - }); - } + }); }); it('should throw error for invalid entry file', () => {