Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ module.exports = {
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
rules: {
'react-hooks/rules-of-hooks': 'error',
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ cache:
script:
- yarn test
- bash <(curl -s https://codecov.io/bash)
- yarn build

jobs:
include:
- stage: release
node_js: lts/*
deploy:
provider: script
skip_cleanup: true
script: yarn semantic-release
6 changes: 4 additions & 2 deletions __tests__/useSafeContext.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ describe('useSafeContext', () => {
it('should throw an error when the context provider is not set and the context has not displayName', () => {
const { result } = renderHook(() => useSafeContext(TestContext));

expect(result.error?.message).toBe('Missing context');
expect(result.error?.message).toMatchInlineSnapshot(`"Missing context"`);
});

it('should throw an error when the context provider is not set and the context has displayName', () => {
TestContext.displayName = 'TestContext';

const { result } = renderHook(() => useSafeContext(TestContext));

expect(result.error?.message).toBe('Missing context: TestContext');
expect(result.error?.message).toMatchInlineSnapshot(
`"Missing context: TestContext"`
);
});
});
Loading