Skip to content

Commit 180d9dd

Browse files
committed
chore: don't access CNContactStore in CI
1 parent 492cb49 commit 180d9dd

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

package-lock.json

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"devDependencies": {
3434
"chai": "^4.2.0",
3535
"clang-format": "^1.3.0",
36+
"is-ci": "^2.0.0",
3637
"mocha": "^6.2.0",
3738
"node-gyp": "^5.0.3",
3839
"prettier": "^2.0.4"

test/module.spec.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ const {
99
listener,
1010
} = require('../index')
1111

12+
const isCI = require('is-ci')
13+
const ifit = (condition) => (condition ? it : it.skip)
14+
const ifdescribe = (condition) => (condition ? describe : describe.skip)
15+
1216
describe('node-mac-contacts', () => {
1317
describe('getAuthStatus()', () => {
1418
it('should not throw', () => {
@@ -92,7 +96,7 @@ describe('node-mac-contacts', () => {
9296
}).to.throw(/emailAddresses must be an array/)
9397
})
9498

95-
it('should successfully add a contact', () => {
99+
ifit(!isCI)('should successfully add a contact', () => {
96100
const success = addNewContact({
97101
firstName: 'William',
98102
lastName: 'Grapeseed',
@@ -128,7 +132,7 @@ describe('node-mac-contacts', () => {
128132
}).to.throw(errorMessage)
129133
})
130134

131-
it('should retrieve a contact by name predicates', () => {
135+
ifit(!isCI)('should retrieve a contact by name predicates', () => {
132136
addNewContact({
133137
firstName: 'Sherlock',
134138
lastName: 'Holmes',
@@ -202,7 +206,7 @@ describe('node-mac-contacts', () => {
202206
})
203207
})
204208

205-
describe('listener', () => {
209+
ifdescribe(!isCI)('listener', () => {
206210
afterEach(() => {
207211
if (listener.isListening()) {
208212
listener.remove()
@@ -219,7 +223,7 @@ describe('node-mac-contacts', () => {
219223
expect(() => {
220224
listener.setup()
221225
listener.setup()
222-
}).to.throw(/An observer already observing/)
226+
}).to.throw(/An observer is already observing/)
223227
})
224228

225229
it('emits an event when the contact is changed', (done) => {

0 commit comments

Comments
 (0)