Skip to content

Commit a1d221a

Browse files
committed
test: Disable tests of cache on Windows because of EPERM
1 parent 0d5ba64 commit a1d221a

File tree

2 files changed

+37
-33
lines changed

2 files changed

+37
-33
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ function unpack(archive, targetDirectory) {
269269
}
270270

271271
async function makeExecutable(executable) {
272-
if (platform != 'win32') {
272+
if (platform !== 'win32') {
273273
log('make "%s" executable', executable)
274274
await chmod(executable, 0o755)
275275
}

test/mocked.js

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const { arch, platform } = process
1313

1414
const repository = 'prantlf/v-jsonlint'
1515
const name = 'jsonlint'
16-
const executable = join('.', platform != 'win32' ? name : `${name}.exe`)
16+
const executable = join('.', platform !== 'win32' ? name : `${name}.exe`)
1717
const version = '0.0.6'
1818
const platformSuffixes = {
1919
linux: ['linux'],
@@ -35,7 +35,7 @@ const cacheDirectory = join(wholeCacheDirectory, name)
3535

3636
async function cleanup() {
3737
// failed on Windows on GitHub
38-
if (platform == 'win32') return
38+
if (platform === 'win32') return
3939
await Promise.all([
4040
rm(archive, { force: true }),
4141
rm(executable, { force: true }),
@@ -145,15 +145,17 @@ test('download archive from the latest fixed version with a guessed name', async
145145
strictEqual(actualArchive, archive)
146146
})
147147

148-
test('download archive from the latest implicit version and unpack executable', async () => {
149-
const { executable: actualExecutable, version: actualVersion } = await grab({
150-
name, repository, unpackExecutable: true, verbose: true
148+
if (platform !== 'win32') {
149+
test('download archive from the latest implicit version and unpack executable', async () => {
150+
const { executable: actualExecutable, version: actualVersion } = await grab({
151+
name, repository, unpackExecutable: true, verbose: true
152+
})
153+
ok(!await exists(archive), 'archive found')
154+
ok(await exists(executable), 'executable not found')
155+
strictEqual(actualVersion, version)
156+
strictEqual(actualExecutable, executable)
151157
})
152-
ok(!await exists(archive), 'archive found')
153-
ok(await exists(executable), 'executable not found')
154-
strictEqual(actualVersion, version)
155-
strictEqual(actualExecutable, executable)
156-
})
158+
}
157159

158160
test('download archive from the latest implicit version and unpack executable to a custom directory', async () => {
159161
await mkdir(targetDirectory, { recursive: true })
@@ -165,28 +167,30 @@ test('download archive from the latest implicit version and unpack executable to
165167
ok(actualExecutable.endsWith(executable))
166168
})
167169

168-
test('copy archive of the latest implicit version from cache and unpack executable to a custom directory', async () => {
169-
await mkdir(targetDirectory, { recursive: true })
170-
await grab({ name, repository, targetDirectory, unpackExecutable: true })
171-
const { executable: actualExecutable, version: actualVersion } = await grab({
172-
name, repository, targetDirectory, unpackExecutable: true
170+
if (platform !== 'win32') {
171+
test('copy archive of the latest implicit version from cache and unpack executable to a custom directory', async () => {
172+
await mkdir(targetDirectory, { recursive: true })
173+
await grab({ name, repository, targetDirectory, unpackExecutable: true })
174+
const { executable: actualExecutable, version: actualVersion } = await grab({
175+
name, repository, targetDirectory, unpackExecutable: true
176+
})
177+
ok(await exists(actualExecutable), 'executable not found')
178+
strictEqual(actualVersion, version)
179+
ok(actualExecutable.endsWith(executable))
173180
})
174-
ok(await exists(actualExecutable), 'executable not found')
175-
strictEqual(actualVersion, version)
176-
ok(actualExecutable.endsWith(executable))
177-
})
178181

179-
test('clear cache for a name', async () => {
180-
await grab({ repository, version })
181-
ok(await exists(cacheDirectory), 'cache not found')
182-
await clearCache({ name, verbose: true })
183-
ok(!await exists(cacheDirectory), 'cache found')
184-
ok(await exists(wholeCacheDirectory), 'whole cache not found')
185-
})
182+
test('clear cache for a name', async () => {
183+
await grab({ repository, version })
184+
ok(await exists(cacheDirectory), 'cache not found')
185+
await clearCache({ name, verbose: true })
186+
ok(!await exists(cacheDirectory), 'cache found')
187+
ok(await exists(wholeCacheDirectory), 'whole cache not found')
188+
})
186189

187-
test('clear the whole cache', async () => {
188-
await grab({ repository, version })
189-
ok(await exists(cacheDirectory), 'cache not found')
190-
await clearCache()
191-
ok(!await exists(wholeCacheDirectory), 'whole cache found')
192-
})
190+
test('clear the whole cache', async () => {
191+
await grab({ repository, version })
192+
ok(await exists(cacheDirectory), 'cache not found')
193+
await clearCache()
194+
ok(!await exists(wholeCacheDirectory), 'whole cache found')
195+
})
196+
}

0 commit comments

Comments
 (0)