finki-main
main
|
Last change
on this file since 81bc7da was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago |
|
Initial commit
|
-
Property mode
set to
100644
|
|
File size:
799 bytes
|
| Line | |
|---|
| 1 | 'use strict'
|
|---|
| 2 |
|
|---|
| 3 | const { test } = require('tap')
|
|---|
| 4 | const { test: { install } } = require('../lib/install')
|
|---|
| 5 | const log = require('npmlog')
|
|---|
| 6 |
|
|---|
| 7 | log.level = 'error' // we expect a warning
|
|---|
| 8 |
|
|---|
| 9 | test('EACCES retry once', async (t) => {
|
|---|
| 10 | t.plan(3)
|
|---|
| 11 |
|
|---|
| 12 | const fs = {
|
|---|
| 13 | promises: {
|
|---|
| 14 | stat (_) {
|
|---|
| 15 | const err = new Error()
|
|---|
| 16 | err.code = 'EACCES'
|
|---|
| 17 | t.ok(true)
|
|---|
| 18 | throw err
|
|---|
| 19 | }
|
|---|
| 20 | }
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | const Gyp = {
|
|---|
| 24 | devDir: __dirname,
|
|---|
| 25 | opts: {
|
|---|
| 26 | ensure: true
|
|---|
| 27 | },
|
|---|
| 28 | commands: {
|
|---|
| 29 | install (argv, cb) {
|
|---|
| 30 | install(fs, Gyp, argv).then(cb, cb)
|
|---|
| 31 | },
|
|---|
| 32 | remove (_, cb) {
|
|---|
| 33 | cb()
|
|---|
| 34 | }
|
|---|
| 35 | }
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | try {
|
|---|
| 39 | await install(fs, Gyp, [])
|
|---|
| 40 | } catch (err) {
|
|---|
| 41 | t.ok(true)
|
|---|
| 42 | if (/"pre" versions of node cannot be installed/.test(err.message)) {
|
|---|
| 43 | t.ok(true)
|
|---|
| 44 | }
|
|---|
| 45 | }
|
|---|
| 46 | })
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.