Investigate spec on mac (#7111)

* run scripts unit tests on Mac too

* build this branch on Mac on CircleCI

* skip some mock file system tests, run them only on Linux

* skip dynamically

* use function expression
This commit is contained in:
Gleb Bahmutov
2020-04-22 13:35:30 -04:00
committed by GitHub
parent 45b759c408
commit eae1a893ff
2 changed files with 46 additions and 6 deletions

View File

@@ -1,3 +1,4 @@
/* global sinon */
const os = require('os')
const _ = require('lodash')
const path = require('path')
@@ -5,6 +6,7 @@ const proxyquire = require('proxyquire')
const mockfs = require('mock-fs')
const _snapshot = require('snap-shot-it')
const chai = require('chai')
const debug = require('debug')('test')
chai.use(require('chai-as-promised'))
@@ -26,6 +28,8 @@ const snapshot = (...args) => {
describe('packages', () => {
it('can copy files from package.json', async () => {
sinon.stub(os, 'tmpdir').returns('/tmp')
mockfs({
'packages': {
'coffee': {
@@ -77,7 +81,12 @@ describe('packages', () => {
})
describe('transformRequires', () => {
it('can find and replace symlink requires', async () => {
it('can find and replace symlink requires', async function () {
// these tests really refuse to work on Mac, so for now run it only on Linux
if (os.platform() !== 'linux') {
return this.skip()
}
const buildRoot = 'build/linux/Cypress/resources/app'
mockfs({
@@ -101,12 +110,22 @@ describe('transformRequires', () => {
// should return number of transformed requires
await expect(transformRequires(buildRoot)).to.eventually.eq(2)
// console.log(getFs())
const files = getFs()
snapshot(getFs())
if (debug.enabled) {
debug('returned file system')
/* eslint-disable-next-line no-console */
console.error(files)
}
snapshot(files)
})
it('can find and replace symlink requires on win32', async () => {
it('can find and replace symlink requires on win32', async function () {
if (os.platform() !== 'linux') {
return this.skip()
}
const { transformRequires } = proxyquire('../../../binary/util/transform-requires', { path: path.win32 })
const buildRoot = 'build/linux/Cypress/resources/app'