Unverified Commit bf31b4ee authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Check CSS Test Output (#10237)

* Check CSS Test Output

* replace more

* Fix tests

* check code

* Add code check

* Check codes everywhere
parent b747f7b2
...@@ -16,8 +16,12 @@ describe('CSS Customization', () => { ...@@ -16,8 +16,12 @@ describe('CSS Customization', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've compiled and prefixed`, async () => { it(`should've compiled and prefixed`, async () => {
...@@ -78,8 +82,12 @@ describe('Legacy Next-CSS Customization', () => { ...@@ -78,8 +82,12 @@ describe('Legacy Next-CSS Customization', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've compiled and prefixed`, async () => { it(`should've compiled and prefixed`, async () => {
...@@ -103,8 +111,12 @@ describe('CSS Customization Array', () => { ...@@ -103,8 +111,12 @@ describe('CSS Customization Array', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've compiled and prefixed`, async () => { it(`should've compiled and prefixed`, async () => {
...@@ -168,9 +180,12 @@ describe('Bad CSS Customization', () => { ...@@ -168,9 +180,12 @@ describe('Bad CSS Customization', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
const { stderr } = await nextBuild(appDir, [], { stderr: true }) const { stdout, stderr } = await nextBuild(appDir, [], {
stdout: true,
stderr: true,
})
expect(stdout).toMatch(/Compiled successfully/)
expect(stderr).toMatch(/field which is not supported.*?sourceMap/) expect(stderr).toMatch(/field which is not supported.*?sourceMap/)
;[ ;[
'postcss-modules-values', 'postcss-modules-values',
......
...@@ -11,9 +11,18 @@ const fixturesDir = join(__dirname, '../fixtures') ...@@ -11,9 +11,18 @@ const fixturesDir = join(__dirname, '../fixtures')
describe('Browserslist: Old', () => { describe('Browserslist: Old', () => {
const appDir = join(fixturesDir, 'browsers-old') const appDir = join(fixturesDir, 'browsers-old')
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
})
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -34,9 +43,18 @@ describe('Browserslist: Old', () => { ...@@ -34,9 +43,18 @@ describe('Browserslist: Old', () => {
describe('Browserslist: New', () => { describe('Browserslist: New', () => {
const appDir = join(fixturesDir, 'browsers-new') const appDir = join(fixturesDir, 'browsers-new')
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
})
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -57,9 +75,18 @@ describe('Browserslist: New', () => { ...@@ -57,9 +75,18 @@ describe('Browserslist: New', () => {
describe('Custom Properties: Pass-Through IE11', () => { describe('Custom Properties: Pass-Through IE11', () => {
const appDir = join(fixturesDir, 'cp-ie-11') const appDir = join(fixturesDir, 'cp-ie-11')
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
})
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -80,9 +107,18 @@ describe('Custom Properties: Pass-Through IE11', () => { ...@@ -80,9 +107,18 @@ describe('Custom Properties: Pass-Through IE11', () => {
describe('Custom Properties: Pass-Through Modern', () => { describe('Custom Properties: Pass-Through Modern', () => {
const appDir = join(fixturesDir, 'cp-modern') const appDir = join(fixturesDir, 'cp-modern')
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
})
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -108,9 +144,10 @@ describe('Custom Properties: Fail for :root {} in CSS Modules', () => { ...@@ -108,9 +144,10 @@ describe('Custom Properties: Fail for :root {} in CSS Modules', () => {
}) })
it('should fail to build', async () => { it('should fail to build', async () => {
const { stderr } = await nextBuild(appDir, [], { const { code, stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
}) })
expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile') expect(stderr).toContain('Failed to compile')
expect(stderr).toContain('pages/styles.module.css') expect(stderr).toContain('pages/styles.module.css')
expect(stderr).toContain('CssSyntax error: Selector ":root" is not pure') expect(stderr).toContain('CssSyntax error: Selector ":root" is not pure')
...@@ -125,9 +162,10 @@ describe('Custom Properties: Fail for global element in CSS Modules', () => { ...@@ -125,9 +162,10 @@ describe('Custom Properties: Fail for global element in CSS Modules', () => {
}) })
it('should fail to build', async () => { it('should fail to build', async () => {
const { stderr } = await nextBuild(appDir, [], { const { code, stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
}) })
expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile') expect(stderr).toContain('Failed to compile')
expect(stderr).toContain('pages/styles.module.css') expect(stderr).toContain('pages/styles.module.css')
expect(stderr).toContain('CssSyntax error: Selector "h1" is not pure') expect(stderr).toContain('CssSyntax error: Selector "h1" is not pure')
...@@ -137,9 +175,18 @@ describe('Custom Properties: Fail for global element in CSS Modules', () => { ...@@ -137,9 +175,18 @@ describe('Custom Properties: Fail for global element in CSS Modules', () => {
describe('CSS Modules: Import Global CSS', () => { describe('CSS Modules: Import Global CSS', () => {
const appDir = join(fixturesDir, 'module-import-global') const appDir = join(fixturesDir, 'module-import-global')
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
})
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -165,9 +212,10 @@ describe('CSS Modules: Importing Invalid Global CSS', () => { ...@@ -165,9 +212,10 @@ describe('CSS Modules: Importing Invalid Global CSS', () => {
}) })
it('should fail to build', async () => { it('should fail to build', async () => {
const { stderr } = await nextBuild(appDir, [], { const { code, stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
}) })
expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile') expect(stderr).toContain('Failed to compile')
expect(stderr).toContain('pages/styles.module.css') expect(stderr).toContain('pages/styles.module.css')
expect(stderr).toContain('CssSyntax error: Selector "a" is not pure') expect(stderr).toContain('CssSyntax error: Selector "a" is not pure')
......
...@@ -23,9 +23,13 @@ describe('Basic CSS Module Support', () => { ...@@ -23,9 +23,13 @@ describe('Basic CSS Module Support', () => {
let appPort let appPort
let app let app
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
appPort = await findPort() appPort = await findPort()
app = await nextStart(appDir, appPort) app = await nextStart(appDir, appPort)
}) })
...@@ -33,6 +37,11 @@ describe('Basic CSS Module Support', () => { ...@@ -33,6 +37,11 @@ describe('Basic CSS Module Support', () => {
await killApp(app) await killApp(app)
}) })
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
const cssFolder = join(appDir, '.next/static/css') const cssFolder = join(appDir, '.next/static/css')
...@@ -70,9 +79,13 @@ describe('3rd Party CSS Module Support', () => { ...@@ -70,9 +79,13 @@ describe('3rd Party CSS Module Support', () => {
let appPort let appPort
let app let app
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
appPort = await findPort() appPort = await findPort()
app = await nextStart(appDir, appPort) app = await nextStart(appDir, appPort)
}) })
...@@ -80,6 +93,11 @@ describe('3rd Party CSS Module Support', () => { ...@@ -80,6 +93,11 @@ describe('3rd Party CSS Module Support', () => {
await killApp(app) await killApp(app)
}) })
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
const cssFolder = join(appDir, '.next/static/css') const cssFolder = join(appDir, '.next/static/css')
...@@ -141,9 +159,13 @@ describe('Has CSS Module in computed styles in Production', () => { ...@@ -141,9 +159,13 @@ describe('Has CSS Module in computed styles in Production', () => {
let appPort let appPort
let app let app
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
appPort = await findPort() appPort = await findPort()
app = await nextStart(appDir, appPort) app = await nextStart(appDir, appPort)
}) })
...@@ -151,6 +173,11 @@ describe('Has CSS Module in computed styles in Production', () => { ...@@ -151,6 +173,11 @@ describe('Has CSS Module in computed styles in Production', () => {
await killApp(app) await killApp(app)
}) })
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
it('should have CSS for page', async () => { it('should have CSS for page', async () => {
const browser = await webdriver(appPort, '/') const browser = await webdriver(appPort, '/')
...@@ -216,9 +243,10 @@ describe('Invalid CSS Module Usage in node_modules', () => { ...@@ -216,9 +243,10 @@ describe('Invalid CSS Module Usage in node_modules', () => {
}) })
it('should fail to build', async () => { it('should fail to build', async () => {
const { stderr } = await nextBuild(appDir, [], { const { code, stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
}) })
expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile') expect(stderr).toContain('Failed to compile')
expect(stderr).toContain('node_modules/example/index.module.css') expect(stderr).toContain('node_modules/example/index.module.css')
expect(stderr).toMatch( expect(stderr).toMatch(
...@@ -236,9 +264,10 @@ describe('Invalid CSS Module Usage in node_modules', () => { ...@@ -236,9 +264,10 @@ describe('Invalid CSS Module Usage in node_modules', () => {
}) })
it('should fail to build', async () => { it('should fail to build', async () => {
const { stderr } = await nextBuild(appDir, [], { const { code, stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
}) })
expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile') expect(stderr).toContain('Failed to compile')
expect(stderr).toContain('node_modules/example/index.css') expect(stderr).toContain('node_modules/example/index.css')
expect(stderr).toMatch( expect(stderr).toMatch(
...@@ -257,8 +286,13 @@ describe('Valid CSS Module Usage from within node_modules', () => { ...@@ -257,8 +286,13 @@ describe('Valid CSS Module Usage from within node_modules', () => {
let appPort let appPort
let app let app
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await remove(join(appDir, '.next'))
;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
appPort = await findPort() appPort = await findPort()
app = await nextStart(appDir, appPort) app = await nextStart(appDir, appPort)
}) })
...@@ -266,6 +300,11 @@ describe('Valid CSS Module Usage from within node_modules', () => { ...@@ -266,6 +300,11 @@ describe('Valid CSS Module Usage from within node_modules', () => {
await killApp(app) await killApp(app)
}) })
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
it(`should've prerendered with relevant data`, async () => { it(`should've prerendered with relevant data`, async () => {
const content = await renderViaHTTP(appPort, '/') const content = await renderViaHTTP(appPort, '/')
const $ = cheerio.load(content) const $ = cheerio.load(content)
...@@ -300,8 +339,13 @@ describe('Valid Nested CSS Module Usage from within node_modules', () => { ...@@ -300,8 +339,13 @@ describe('Valid Nested CSS Module Usage from within node_modules', () => {
let appPort let appPort
let app let app
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await remove(join(appDir, '.next'))
;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
appPort = await findPort() appPort = await findPort()
app = await nextStart(appDir, appPort) app = await nextStart(appDir, appPort)
}) })
...@@ -309,6 +353,11 @@ describe('Valid Nested CSS Module Usage from within node_modules', () => { ...@@ -309,6 +353,11 @@ describe('Valid Nested CSS Module Usage from within node_modules', () => {
await killApp(app) await killApp(app)
}) })
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
it(`should've prerendered with relevant data`, async () => { it(`should've prerendered with relevant data`, async () => {
const content = await renderViaHTTP(appPort, '/') const content = await renderViaHTTP(appPort, '/')
const $ = cheerio.load(content) const $ = cheerio.load(content)
...@@ -338,9 +387,18 @@ describe('CSS Module Composes Usage (Basic)', () => { ...@@ -338,9 +387,18 @@ describe('CSS Module Composes Usage (Basic)', () => {
// This is a very bad feature. Do not use it. // This is a very bad feature. Do not use it.
const appDir = join(fixturesDir, 'composes-basic') const appDir = join(fixturesDir, 'composes-basic')
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
})
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -362,9 +420,18 @@ describe('CSS Module Composes Usage (External)', () => { ...@@ -362,9 +420,18 @@ describe('CSS Module Composes Usage (External)', () => {
// This is a very bad feature. Do not use it. // This is a very bad feature. Do not use it.
const appDir = join(fixturesDir, 'composes-external') const appDir = join(fixturesDir, 'composes-external')
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
})
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
......
...@@ -28,8 +28,12 @@ describe('CSS Support', () => { ...@@ -28,8 +28,12 @@ describe('CSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -52,8 +56,12 @@ describe('CSS Support', () => { ...@@ -52,8 +56,12 @@ describe('CSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -76,8 +84,12 @@ describe('CSS Support', () => { ...@@ -76,8 +84,12 @@ describe('CSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -101,8 +113,12 @@ describe('CSS Support', () => { ...@@ -101,8 +113,12 @@ describe('CSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -128,8 +144,12 @@ describe('CSS Support', () => { ...@@ -128,8 +144,12 @@ describe('CSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've compiled and prefixed`, async () => { it(`should've compiled and prefixed`, async () => {
...@@ -187,8 +207,12 @@ describe('CSS Support', () => { ...@@ -187,8 +207,12 @@ describe('CSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -213,9 +237,10 @@ describe('CSS Support', () => { ...@@ -213,9 +237,10 @@ describe('CSS Support', () => {
}) })
it('should fail to build', async () => { it('should fail to build', async () => {
const { stderr } = await nextBuild(appDir, [], { const { code, stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
}) })
expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile') expect(stderr).toContain('Failed to compile')
expect(stderr).toContain('styles.module.css') expect(stderr).toContain('styles.module.css')
expect(stderr).toMatch( expect(stderr).toMatch(
...@@ -233,9 +258,10 @@ describe('CSS Support', () => { ...@@ -233,9 +258,10 @@ describe('CSS Support', () => {
}) })
it('should fail to build', async () => { it('should fail to build', async () => {
const { stderr } = await nextBuild(appDir, [], { const { code, stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
}) })
expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile') expect(stderr).toContain('Failed to compile')
expect(stderr).toContain('styles/global.css') expect(stderr).toContain('styles/global.css')
expect(stderr).toMatch( expect(stderr).toMatch(
...@@ -253,9 +279,10 @@ describe('CSS Support', () => { ...@@ -253,9 +279,10 @@ describe('CSS Support', () => {
}) })
it('should fail to build', async () => { it('should fail to build', async () => {
const { stderr } = await nextBuild(appDir, [], { const { code, stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
}) })
expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile') expect(stderr).toContain('Failed to compile')
expect(stderr).toContain('styles/global.css') expect(stderr).toContain('styles/global.css')
expect(stderr).toMatch( expect(stderr).toMatch(
...@@ -273,9 +300,10 @@ describe('CSS Support', () => { ...@@ -273,9 +300,10 @@ describe('CSS Support', () => {
}) })
it('should fail to build', async () => { it('should fail to build', async () => {
const { stderr } = await nextBuild(appDir, [], { const { code, stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
}) })
expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile') expect(stderr).toContain('Failed to compile')
expect(stderr).toContain('styles/global.css') expect(stderr).toContain('styles/global.css')
expect(stderr).toContain('Please move all global CSS imports') expect(stderr).toContain('Please move all global CSS imports')
...@@ -448,9 +476,13 @@ describe('CSS Support', () => { ...@@ -448,9 +476,13 @@ describe('CSS Support', () => {
let appPort let appPort
let app let app
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
appPort = await findPort() appPort = await findPort()
app = await nextStart(appDir, appPort) app = await nextStart(appDir, appPort)
}) })
...@@ -458,6 +490,11 @@ describe('CSS Support', () => { ...@@ -458,6 +490,11 @@ describe('CSS Support', () => {
await killApp(app) await killApp(app)
}) })
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
it('should have CSS for page', async () => { it('should have CSS for page', async () => {
const browser = await webdriver(appPort, '/page2') const browser = await webdriver(appPort, '/page2')
...@@ -495,8 +532,12 @@ describe('CSS Support', () => { ...@@ -495,8 +532,12 @@ describe('CSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted expected files`, async () => { it(`should've emitted expected files`, async () => {
...@@ -540,8 +581,12 @@ describe('CSS Support', () => { ...@@ -540,8 +581,12 @@ describe('CSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted expected files`, async () => { it(`should've emitted expected files`, async () => {
...@@ -585,8 +630,12 @@ describe('CSS Support', () => { ...@@ -585,8 +630,12 @@ describe('CSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted expected files`, async () => { it(`should've emitted expected files`, async () => {
...@@ -630,8 +679,12 @@ describe('CSS Support', () => { ...@@ -630,8 +679,12 @@ describe('CSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -653,8 +706,12 @@ describe('CSS Support', () => { ...@@ -653,8 +706,12 @@ describe('CSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -679,8 +736,9 @@ describe('CSS Support', () => { ...@@ -679,8 +736,9 @@ describe('CSS Support', () => {
}) })
it('should fail the build', async () => { it('should fail the build', async () => {
const { stderr } = await nextBuild(appDir, [], { stderr: true }) const { code, stderr } = await nextBuild(appDir, [], { stderr: true })
expect(code).not.toBe(0)
expect(stderr).toMatch(/Can't resolve '[^']*?nprogress[^']*?'/) expect(stderr).toMatch(/Can't resolve '[^']*?nprogress[^']*?'/)
expect(stderr).toMatch(/Build error occurred/) expect(stderr).toMatch(/Build error occurred/)
}) })
...@@ -715,9 +773,13 @@ describe('CSS Support', () => { ...@@ -715,9 +773,13 @@ describe('CSS Support', () => {
let appPort let appPort
let app let app
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
appPort = await findPort() appPort = await findPort()
app = await nextStart(appDir, appPort) app = await nextStart(appDir, appPort)
}) })
...@@ -725,6 +787,11 @@ describe('CSS Support', () => { ...@@ -725,6 +787,11 @@ describe('CSS Support', () => {
await killApp(app) await killApp(app)
}) })
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
it('should have the correct color (css ordering)', async () => { it('should have the correct color (css ordering)', async () => {
const browser = await webdriver(appPort, '/') const browser = await webdriver(appPort, '/')
...@@ -742,8 +809,12 @@ describe('CSS Support', () => { ...@@ -742,8 +809,12 @@ describe('CSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've compiled and prefixed`, async () => { it(`should've compiled and prefixed`, async () => {
...@@ -779,8 +850,12 @@ describe('CSS Support', () => { ...@@ -779,8 +850,12 @@ describe('CSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've compiled and prefixed`, async () => { it(`should've compiled and prefixed`, async () => {
......
...@@ -23,9 +23,13 @@ describe('Basic SCSS Module Support', () => { ...@@ -23,9 +23,13 @@ describe('Basic SCSS Module Support', () => {
let appPort let appPort
let app let app
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
appPort = await findPort() appPort = await findPort()
app = await nextStart(appDir, appPort) app = await nextStart(appDir, appPort)
}) })
...@@ -33,6 +37,11 @@ describe('Basic SCSS Module Support', () => { ...@@ -33,6 +37,11 @@ describe('Basic SCSS Module Support', () => {
await killApp(app) await killApp(app)
}) })
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
const cssFolder = join(appDir, '.next/static/css') const cssFolder = join(appDir, '.next/static/css')
...@@ -70,9 +79,13 @@ describe('3rd Party CSS Module Support', () => { ...@@ -70,9 +79,13 @@ describe('3rd Party CSS Module Support', () => {
let appPort let appPort
let app let app
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
appPort = await findPort() appPort = await findPort()
app = await nextStart(appDir, appPort) app = await nextStart(appDir, appPort)
}) })
...@@ -80,6 +93,11 @@ describe('3rd Party CSS Module Support', () => { ...@@ -80,6 +93,11 @@ describe('3rd Party CSS Module Support', () => {
await killApp(app) await killApp(app)
}) })
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
const cssFolder = join(appDir, '.next/static/css') const cssFolder = join(appDir, '.next/static/css')
...@@ -141,9 +159,13 @@ describe('Has CSS Module in computed styles in Production', () => { ...@@ -141,9 +159,13 @@ describe('Has CSS Module in computed styles in Production', () => {
let appPort let appPort
let app let app
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
appPort = await findPort() appPort = await findPort()
app = await nextStart(appDir, appPort) app = await nextStart(appDir, appPort)
}) })
...@@ -151,6 +173,11 @@ describe('Has CSS Module in computed styles in Production', () => { ...@@ -151,6 +173,11 @@ describe('Has CSS Module in computed styles in Production', () => {
await killApp(app) await killApp(app)
}) })
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
it('should have CSS for page', async () => { it('should have CSS for page', async () => {
const browser = await webdriver(appPort, '/') const browser = await webdriver(appPort, '/')
...@@ -216,9 +243,10 @@ describe('Invalid CSS Module Usage in node_modules', () => { ...@@ -216,9 +243,10 @@ describe('Invalid CSS Module Usage in node_modules', () => {
}) })
it('should fail to build', async () => { it('should fail to build', async () => {
const { stderr } = await nextBuild(appDir, [], { const { code, stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
}) })
expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile') expect(stderr).toContain('Failed to compile')
expect(stderr).toContain('node_modules/example/index.module.scss') expect(stderr).toContain('node_modules/example/index.module.scss')
expect(stderr).toMatch( expect(stderr).toMatch(
...@@ -236,9 +264,10 @@ describe('Invalid CSS Module Usage in node_modules', () => { ...@@ -236,9 +264,10 @@ describe('Invalid CSS Module Usage in node_modules', () => {
}) })
it('should fail to build', async () => { it('should fail to build', async () => {
const { stderr } = await nextBuild(appDir, [], { const { code, stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
}) })
expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile') expect(stderr).toContain('Failed to compile')
expect(stderr).toContain('node_modules/example/index.scss') expect(stderr).toContain('node_modules/example/index.scss')
expect(stderr).toMatch( expect(stderr).toMatch(
...@@ -257,8 +286,13 @@ describe('Valid CSS Module Usage from within node_modules', () => { ...@@ -257,8 +286,13 @@ describe('Valid CSS Module Usage from within node_modules', () => {
let appPort let appPort
let app let app
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await remove(join(appDir, '.next'))
;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
appPort = await findPort() appPort = await findPort()
app = await nextStart(appDir, appPort) app = await nextStart(appDir, appPort)
}) })
...@@ -266,6 +300,11 @@ describe('Valid CSS Module Usage from within node_modules', () => { ...@@ -266,6 +300,11 @@ describe('Valid CSS Module Usage from within node_modules', () => {
await killApp(app) await killApp(app)
}) })
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
it(`should've prerendered with relevant data`, async () => { it(`should've prerendered with relevant data`, async () => {
const content = await renderViaHTTP(appPort, '/') const content = await renderViaHTTP(appPort, '/')
const $ = cheerio.load(content) const $ = cheerio.load(content)
...@@ -300,8 +339,13 @@ describe('Valid Nested CSS Module Usage from within node_modules', () => { ...@@ -300,8 +339,13 @@ describe('Valid Nested CSS Module Usage from within node_modules', () => {
let appPort let appPort
let app let app
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await nextBuild(appDir) await remove(join(appDir, '.next'))
;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
appPort = await findPort() appPort = await findPort()
app = await nextStart(appDir, appPort) app = await nextStart(appDir, appPort)
}) })
...@@ -309,6 +353,11 @@ describe('Valid Nested CSS Module Usage from within node_modules', () => { ...@@ -309,6 +353,11 @@ describe('Valid Nested CSS Module Usage from within node_modules', () => {
await killApp(app) await killApp(app)
}) })
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
it(`should've prerendered with relevant data`, async () => { it(`should've prerendered with relevant data`, async () => {
const content = await renderViaHTTP(appPort, '/') const content = await renderViaHTTP(appPort, '/')
const $ = cheerio.load(content) const $ = cheerio.load(content)
...@@ -338,9 +387,18 @@ describe('CSS Module Composes Usage (Basic)', () => { ...@@ -338,9 +387,18 @@ describe('CSS Module Composes Usage (Basic)', () => {
// This is a very bad feature. Do not use it. // This is a very bad feature. Do not use it.
const appDir = join(fixturesDir, 'composes-basic') const appDir = join(fixturesDir, 'composes-basic')
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
})
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -362,9 +420,18 @@ describe('CSS Module Composes Usage (External)', () => { ...@@ -362,9 +420,18 @@ describe('CSS Module Composes Usage (External)', () => {
// This is a very bad feature. Do not use it. // This is a very bad feature. Do not use it.
const appDir = join(fixturesDir, 'composes-external') const appDir = join(fixturesDir, 'composes-external')
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
})
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
......
...@@ -28,8 +28,12 @@ describe('SCSS Support', () => { ...@@ -28,8 +28,12 @@ describe('SCSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -52,8 +56,12 @@ describe('SCSS Support', () => { ...@@ -52,8 +56,12 @@ describe('SCSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -76,8 +84,12 @@ describe('SCSS Support', () => { ...@@ -76,8 +84,12 @@ describe('SCSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -101,8 +113,12 @@ describe('SCSS Support', () => { ...@@ -101,8 +113,12 @@ describe('SCSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -128,8 +144,12 @@ describe('SCSS Support', () => { ...@@ -128,8 +144,12 @@ describe('SCSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've compiled and prefixed`, async () => { it(`should've compiled and prefixed`, async () => {
...@@ -188,8 +208,12 @@ describe('SCSS Support', () => { ...@@ -188,8 +208,12 @@ describe('SCSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -214,9 +238,10 @@ describe('SCSS Support', () => { ...@@ -214,9 +238,10 @@ describe('SCSS Support', () => {
}) })
it('should fail to build', async () => { it('should fail to build', async () => {
const { stderr } = await nextBuild(appDir, [], { const { code, stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
}) })
expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile') expect(stderr).toContain('Failed to compile')
expect(stderr).toContain('styles.module.scss') expect(stderr).toContain('styles.module.scss')
expect(stderr).toMatch( expect(stderr).toMatch(
...@@ -234,9 +259,10 @@ describe('SCSS Support', () => { ...@@ -234,9 +259,10 @@ describe('SCSS Support', () => {
}) })
it('should fail to build', async () => { it('should fail to build', async () => {
const { stderr } = await nextBuild(appDir, [], { const { code, stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
}) })
expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile') expect(stderr).toContain('Failed to compile')
expect(stderr).toContain('styles/global.scss') expect(stderr).toContain('styles/global.scss')
expect(stderr).toMatch( expect(stderr).toMatch(
...@@ -254,9 +280,10 @@ describe('SCSS Support', () => { ...@@ -254,9 +280,10 @@ describe('SCSS Support', () => {
}) })
it('should fail to build', async () => { it('should fail to build', async () => {
const { stderr } = await nextBuild(appDir, [], { const { code, stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
}) })
expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile') expect(stderr).toContain('Failed to compile')
expect(stderr).toContain('styles/global.scss') expect(stderr).toContain('styles/global.scss')
expect(stderr).toMatch( expect(stderr).toMatch(
...@@ -274,9 +301,10 @@ describe('SCSS Support', () => { ...@@ -274,9 +301,10 @@ describe('SCSS Support', () => {
}) })
it('should fail to build', async () => { it('should fail to build', async () => {
const { stderr } = await nextBuild(appDir, [], { const { code, stderr } = await nextBuild(appDir, [], {
stderr: true, stderr: true,
}) })
expect(code).not.toBe(0)
expect(stderr).toContain('Failed to compile') expect(stderr).toContain('Failed to compile')
expect(stderr).toContain('styles/global.scss') expect(stderr).toContain('styles/global.scss')
expect(stderr).toContain('Please move all global CSS imports') expect(stderr).toContain('Please move all global CSS imports')
...@@ -449,9 +477,13 @@ describe('SCSS Support', () => { ...@@ -449,9 +477,13 @@ describe('SCSS Support', () => {
let appPort let appPort
let app let app
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
appPort = await findPort() appPort = await findPort()
app = await nextStart(appDir, appPort) app = await nextStart(appDir, appPort)
}) })
...@@ -459,6 +491,11 @@ describe('SCSS Support', () => { ...@@ -459,6 +491,11 @@ describe('SCSS Support', () => {
await killApp(app) await killApp(app)
}) })
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
it('should have CSS for page', async () => { it('should have CSS for page', async () => {
const browser = await webdriver(appPort, '/page2') const browser = await webdriver(appPort, '/page2')
...@@ -496,8 +533,12 @@ describe('SCSS Support', () => { ...@@ -496,8 +533,12 @@ describe('SCSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted expected files`, async () => { it(`should've emitted expected files`, async () => {
...@@ -541,8 +582,12 @@ describe('SCSS Support', () => { ...@@ -541,8 +582,12 @@ describe('SCSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted expected files`, async () => { it(`should've emitted expected files`, async () => {
...@@ -586,8 +631,12 @@ describe('SCSS Support', () => { ...@@ -586,8 +631,12 @@ describe('SCSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted expected files`, async () => { it(`should've emitted expected files`, async () => {
...@@ -631,8 +680,12 @@ describe('SCSS Support', () => { ...@@ -631,8 +680,12 @@ describe('SCSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -654,8 +707,12 @@ describe('SCSS Support', () => { ...@@ -654,8 +707,12 @@ describe('SCSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've emitted a single CSS file`, async () => { it(`should've emitted a single CSS file`, async () => {
...@@ -680,8 +737,9 @@ describe('SCSS Support', () => { ...@@ -680,8 +737,9 @@ describe('SCSS Support', () => {
}) })
it('should fail the build', async () => { it('should fail the build', async () => {
const { stderr } = await nextBuild(appDir, [], { stderr: true }) const { code, stderr } = await nextBuild(appDir, [], { stderr: true })
expect(code).not.toBe(0)
expect(stderr).toMatch(/Can't resolve '[^']*?nprogress[^']*?'/) expect(stderr).toMatch(/Can't resolve '[^']*?nprogress[^']*?'/)
expect(stderr).toMatch(/Build error occurred/) expect(stderr).toMatch(/Build error occurred/)
}) })
...@@ -716,9 +774,13 @@ describe('SCSS Support', () => { ...@@ -716,9 +774,13 @@ describe('SCSS Support', () => {
let appPort let appPort
let app let app
let stdout
let code
beforeAll(async () => { beforeAll(async () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
await nextBuild(appDir) ;({ code, stdout } = await nextBuild(appDir, [], {
stdout: true,
}))
appPort = await findPort() appPort = await findPort()
app = await nextStart(appDir, appPort) app = await nextStart(appDir, appPort)
}) })
...@@ -726,6 +788,11 @@ describe('SCSS Support', () => { ...@@ -726,6 +788,11 @@ describe('SCSS Support', () => {
await killApp(app) await killApp(app)
}) })
it('should have compiled successfully', () => {
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
it('should have the correct color (css ordering)', async () => { it('should have the correct color (css ordering)', async () => {
const browser = await webdriver(appPort, '/') const browser = await webdriver(appPort, '/')
...@@ -743,8 +810,12 @@ describe('SCSS Support', () => { ...@@ -743,8 +810,12 @@ describe('SCSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've compiled and prefixed`, async () => { it(`should've compiled and prefixed`, async () => {
...@@ -780,8 +851,12 @@ describe('SCSS Support', () => { ...@@ -780,8 +851,12 @@ describe('SCSS Support', () => {
await remove(join(appDir, '.next')) await remove(join(appDir, '.next'))
}) })
it('should build successfully', async () => { it('should compile successfully', async () => {
await nextBuild(appDir) const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
}) })
it(`should've compiled and prefixed`, async () => { it(`should've compiled and prefixed`, async () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment