-
Notifications
You must be signed in to change notification settings - Fork 27.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
95 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.global { | ||
background-color: #eeeeee; | ||
} |
3 changes: 3 additions & 0 deletions
3
test/integration/document-file-dependencies/css/error.module.css
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,3 @@ | ||
.error { | ||
color: #ff0000; | ||
} |
3 changes: 3 additions & 0 deletions
3
test/integration/document-file-dependencies/css/index.module.css
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,3 @@ | ||
.index { | ||
color: #333333; | ||
} |
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,11 @@ | ||
import '../css/app.css' | ||
|
||
function App({ Component, pageProps }) { | ||
return ( | ||
<div className="global"> | ||
<Component {...pageProps} /> | ||
</div> | ||
) | ||
} | ||
|
||
export default App |
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,5 @@ | ||
import style from '../css/error.module.css' | ||
|
||
export default function Error() { | ||
return <div className={style.error}>error</div> | ||
} |
14 changes: 14 additions & 0 deletions
14
test/integration/document-file-dependencies/pages/error-trigger.js
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,14 @@ | ||
import style from '../css/index.module.css' | ||
|
||
function ErrorTrigger() { | ||
return <div className={style.index}>error-trigger</div> | ||
} | ||
|
||
ErrorTrigger.getInitialProps = () => { | ||
throw new Error('Intentional Error') | ||
|
||
// eslint-disable-next-line no-unreachable | ||
return {} | ||
} | ||
|
||
export default ErrorTrigger |
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,5 @@ | ||
import style from '../css/index.module.css' | ||
|
||
export default function Index() { | ||
return <div className={style.index}>index</div> | ||
} |
50 changes: 50 additions & 0 deletions
50
test/integration/document-file-dependencies/test/index.test.js
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,50 @@ | ||
/* eslint-env jest */ | ||
|
||
import { join } from 'path' | ||
import { | ||
fetchViaHTTP, | ||
findPort, | ||
killApp, | ||
nextBuild, | ||
nextStart, | ||
} from 'next-test-utils' | ||
import cheerio from 'cheerio' | ||
|
||
jest.setTimeout(1000 * 60 * 2) | ||
const appDir = join(__dirname, '..') | ||
|
||
let appPort | ||
let app | ||
|
||
describe('File Dependencies', () => { | ||
describe('production mode', () => { | ||
beforeAll(async () => { | ||
appPort = await findPort() | ||
await nextBuild(appDir) | ||
app = await nextStart(appDir, appPort) | ||
}) | ||
|
||
afterAll(() => killApp(app)) | ||
|
||
it('should depend on global and module css files in standard page', async () => { | ||
const res = await fetchViaHTTP(appPort, '/') | ||
const $ = cheerio.load(await res.text()) | ||
const cssFiles = $('link[rel="stylesheet"]') | ||
expect(cssFiles.length).toBe(2) | ||
}) | ||
|
||
it('should depend on global and module css files in 404 page', async () => { | ||
const res = await fetchViaHTTP(appPort, '/__not_found__') | ||
const $ = cheerio.load(await res.text()) | ||
const cssFiles = $('link[rel="stylesheet"]') | ||
expect(cssFiles.length).toBe(2) | ||
}) | ||
|
||
it('should depend on global and module css files in _error page', async () => { | ||
const res = await fetchViaHTTP(appPort, '/error-trigger') | ||
const $ = cheerio.load(await res.text()) | ||
const cssFiles = $('link[rel="stylesheet"]') | ||
expect(cssFiles.length).toBe(2) | ||
}) | ||
}) | ||
}) |