Skip to content

Commit 98b7e5c

Browse files
committed
Update tests
1 parent eb3a867 commit 98b7e5c

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

test/integration/image-optimizer/test/index.test.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -727,20 +727,28 @@ function runTests({ w, isDev, domains = [], ttl, isSharp }) {
727727
expect(Object.keys(json1).length).toBe(1)
728728
})
729729

730-
if (isDev || isSharp) {
731-
it('should not have runtime sharp missing warning', () => {
730+
if (isDev) {
731+
it('should not have runtime warning in dev', () => {
732732
expect(nextOutput).not.toContain(sharpRuntimeWarning)
733733
})
734734

735-
it('should not have runtime sharp missing warning', () => {
735+
it('should not have build warning in dev', () => {
736+
expect(buildOutput).not.toContain(sharpBuildWarning)
737+
})
738+
} else if (isSharp) {
739+
it('should not have runtime warning when sharp is installed', () => {
740+
expect(nextOutput).not.toContain(sharpRuntimeWarning)
741+
})
742+
743+
it('should not have build warning when sharp is installed', () => {
736744
expect(buildOutput).not.toContain(sharpBuildWarning)
737745
})
738746
} else {
739-
it('should have runtime sharp missing warning', () => {
747+
it('should have runtime warning when sharp is not installed', () => {
740748
expect(nextOutput).toContain(sharpRuntimeWarning)
741749
})
742750

743-
it('should have build time sharp missing warning', () => {
751+
it('should have build warning when sharp is not installed', () => {
744752
expect(buildOutput).toContain(sharpBuildWarning)
745753
})
746754
}
@@ -919,6 +927,7 @@ describe('Image Optimizer', () => {
919927
},
920928
})
921929
nextOutput = ''
930+
buildOutput = ''
922931
nextConfig.replace('{ /* replaceme */ }', json)
923932
const out = await nextBuild(appDir, [], { stderr: true })
924933
buildOutput = out.stderr
@@ -1096,6 +1105,7 @@ describe('Image Optimizer', () => {
10961105
const size = 384 // defaults defined in server/config.ts
10971106
beforeAll(async () => {
10981107
nextOutput = ''
1108+
buildOutput = ''
10991109
appPort = await findPort()
11001110
app = await launchApp(appDir, appPort, {
11011111
onStderr(msg) {
@@ -1123,6 +1133,7 @@ describe('Image Optimizer', () => {
11231133
},
11241134
})
11251135
nextOutput = ''
1136+
buildOutput = ''
11261137
nextConfig.replace('{ /* replaceme */ }', json)
11271138
appPort = await findPort()
11281139
app = await launchApp(appDir, appPort, {
@@ -1145,6 +1156,7 @@ describe('Image Optimizer', () => {
11451156
const size = 384 // defaults defined in server/config.ts
11461157
beforeAll(async () => {
11471158
nextOutput = ''
1159+
buildOutput = ''
11481160
const out = await nextBuild(appDir, [], { stderr: true })
11491161
buildOutput = out.stderr
11501162
appPort = await findPort()
@@ -1180,6 +1192,7 @@ describe('Image Optimizer', () => {
11801192
},
11811193
})
11821194
nextOutput = ''
1195+
buildOutput = ''
11831196
nextConfig.replace('{ /* replaceme */ }', json)
11841197
const out = await nextBuild(appDir, [], { stderr: true })
11851198
buildOutput = out.stderr

0 commit comments

Comments
 (0)