I want to setup the following Component and want to run the following basic unit test on it.
(I'm new to Vue.js and not sure which information is valuable for solving my question. Please ask if some other specific code parts would help you to help me.)
user-information.vue:
<template>
<v-layout row wrap justify-center id="wrapper">
<v-flex class="text-xs-center centered">
<v-card>
<v-card-title primary class="title">
User Management
</v-card-title>
</v-card>
</v-flex>
</v-layout>
</template>
<script>
import { mapState } from 'vuex'
export default {
computed: mapState({
users: state => state.userStore.users,
status: state => state.userStore.status
}),
created() {
this.$store.commit('userStore/setDefaultUserStatus');
this.$store.dispatch('userStore/getAllUsers');
},
methods: {
deleteUser
this.$store.commit('userStore/setDefaultUserStatus');
if (confirm('Are you sure?')) {
this.$store.dispatch('userSTore/deleteUser', userId);
}
}
}
}
</script>
LandingPage.spec.js:
import { mount } from '#vue/test-utils';
import UserInformation./../../src/renderer/components/User/user-information.vue';
describe('user-information.vue', () => {
test('is a Vue instance', () => {
const wrapper = mount(UserInformation);
expect(wrapper.isVueInstance()).toBeTruthy();
});
});
When I run npm test, I get the following error:
$ npm test
> management-system#0.1.0 test /home/juri/develop/management-system
> jest
FAIL test/e2e/specs/Launch.spec.js
● Test suite failed to run
Your test suite must contain at least one test.
at node_modules/jest/node_modules/jest-cli/build/TestScheduler.js:256:22
FAIL test/unit/specs/LandingPage.spec.js
● Console
console.error node_modules/vue/dist/vue.runtime.common.js:589
[Vue warn]: Error in config.errorHandler: "TypeError: Cannot read property 'commit' of undefined"
console.error node_modules/vue/dist/vue.runtime.common.js:1739
TypeError: Cannot read property 'commit' of undefined
at VueComponent.created (/home/juri/develop/management-system/src/renderer/components/USer/user-information.vue:85:1)
at callHook (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2919:21)
at VueComponent.Vue._init (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:4628:5)
at new VueComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:4796:12)
at createComponentInstanceForVnode (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:4308:10)
at init (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:4129:45)
at createComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:5606:9)
at createElm (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:5553:9)
at VueComponent.patch [as __patch__] (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:6089:7)
at VueComponent.Vue._update (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2658:19)
at VueComponent.updateComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2786:10)
at Watcher.get (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3140:25)
at new Watcher (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3129:12)
at mountComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2793:3)
at VueComponent.Object.<anonymous>.Vue.$mount (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:7997:10)
at mount (/home/juri/develop/management-system/node_modules/#vue/test-utils/dist/vue-test-utils.js:5645:21)
at Object.test (/home/juri/develop/management-system/test/unit/specs/LandingPage.spec.js:26:21)
at Object.asyncJestTest (/home/juri/develop/management-system/node_modules/jest-jasmine2/build/jasmine_async.js:108:37)
at resolve (/home/juri/develop/management-system/node_modules/jest-jasmine2/build/queue_runner.js:56:12)
at new Promise (<anonymous>)
at mapper (/home/juri/develop/management-system/node_modules/jest-jasmine2/build/queue_runner.js:43:19)
at promise.then (/home/juri/develop/management-system/node_modules/jest-jasmine2/build/queue_runner.js:87:41)
at process.internalTickCallback (internal/process/next_tick.js:77:7)
console.error node_modules/vue/dist/vue.runtime.common.js:589
[Vue warn]: Error in created hook: "TypeError: Cannot read property 'commit' of undefined"
found in
---> <Anonymous>
<Root>
console.error node_modules/vue/dist/vue.runtime.common.js:1739
TypeError: Cannot read property 'commit' of undefined
at VueComponent.created (/home/juri/develop/management-system/src/renderer/components/User/user-information.vue:85:1)
at callHook (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2919:21)
at VueComponent.Vue._init (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:4628:5)
at new VueComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:4796:12)
at createComponentInstanceForVnode (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:4308:10)
at init (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:4129:45)
at createComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:5606:9)
at createElm (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:5553:9)
at VueComponent.patch [as __patch__] (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:6089:7)
at VueComponent.Vue._update (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2658:19)
at VueComponent.updateComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2786:10)
at Watcher.get (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3140:25)
at new Watcher (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3129:12)
at mountComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2793:3)
at VueComponent.Object.<anonymous>.Vue.$mount (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:7997:10)
at mount (/home/juri/develop/management-system/node_modules/#vue/test-utils/dist/vue-test-utils.js:5645:21)
at Object.test (/home/juri/develop/management-system/test/unit/specs/LandingPage.spec.js:26:21)
at Object.asyncJestTest (/home/juri/develop/management-system/node_modules/jest-jasmine2/build/jasmine_async.js:108:37)
at resolve (/home/juri/develop/management-system/node_modules/jest-jasmine2/build/queue_runner.js:56:12)
at new Promise (<anonymous>)
at mapper (/home/juri/develop/management-system/node_modules/jest-jasmine2/build/queue_runner.js:43:19)
at promise.then (/home/juri/develop/management-system/node_modules/jest-jasmine2/build/queue_runner.js:87:41)
at process.internalTickCallback (internal/process/next_tick.js:77:7)
console.error node_modules/vue/dist/vue.runtime.common.js:589
[Vue warn]: Error in config.errorHandler: "TypeError: Cannot read property 'state' of undefined"
console.error node_modules/vue/dist/vue.runtime.common.js:1739
TypeError: Cannot read property 'state' of undefined
at VueComponent.mappedState (/home/juri/develop/management-system/node_modules/vuex/dist/vuex.common.js:793:31)
at Watcher.get (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3140:25)
at Watcher.evaluate (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3247:21)
at Proxy.computedGetter (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3505:17)
at Proxy.render (/home/juri/develop/management-system/src/renderer/components/User/user-information.vue:275:417)
at VueComponent.Vue._render (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:4542:22)
at VueComponent.updateComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2786:21)
at Watcher.get (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3140:25)
at new Watcher (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3129:12)
at mountComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2793:3)
at VueComponent.Object.<anonymous>.Vue.$mount (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:7997:10)
at init (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:4135:13)
at createComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:5606:9)
at createElm (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:5553:9)
at VueComponent.patch [as __patch__] (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:6089:7)
at VueComponent.Vue._update (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2658:19)
at VueComponent.updateComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2786:10)
at Watcher.get (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3140:25)
at new Watcher (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3129:12)
at mountComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2793:3)
at VueComponent.Object.<anonymous>.Vue.$mount (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:7997:10)
at mount (/home/juri/develop/management-system/node_modules/#vue/test-utils/dist/vue-test-utils.js:5645:21)
at Object.test (/home/juri/develop/management-system/test/unit/specs/LandingPage.spec.js:26:21)
at Object.asyncJestTest (/home/juri/develop/management-system/node_modules/jest-jasmine2/build/jasmine_async.js:108:37)
at resolve (/home/juri/develop/management-system/node_modules/jest-jasmine2/build/queue_runner.js:56:12)
at new Promise (<anonymous>)
at mapper (/home/juri/develop/management-system/node_modules/jest-jasmine2/build/queue_runner.js:43:19)
at promise.then (/home/juri/develop/management-system/node_modules/jest-jasmine2/build/queue_runner.js:87:41)
at process.internalTickCallback (internal/process/next_tick.js:77:7)
console.error node_modules/vue/dist/vue.runtime.common.js:589
[Vue warn]: Error in render: "TypeError: Cannot read property 'state' of undefined"
found in
---> <Anonymous>
<Root>
console.error node_modules/vue/dist/vue.runtime.common.js:1739
TypeError: Cannot read property 'state' of undefined
at VueComponent.mappedState (/home/juri/develop/management-system/node_modules/vuex/dist/vuex.common.js:793:31)
at Watcher.get (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3140:25)
at Watcher.evaluate (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3247:21)
at Proxy.computedGetter (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3505:17)
at Proxy.render (/home/juri/develop/management-system/src/renderer/components/User/user-information.vue:275:417)
at VueComponent.Vue._render (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:4542:22)
at VueComponent.updateComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2786:21)
at Watcher.get (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3140:25)
at new Watcher (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3129:12)
at mountComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2793:3)
at VueComponent.Object.<anonymous>.Vue.$mount (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:7997:10)
at init (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:4135:13)
at createComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:5606:9)
at createElm (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:5553:9)
at VueComponent.patch [as __patch__] (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:6089:7)
at VueComponent.Vue._update (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2658:19)
at VueComponent.updateComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2786:10)
at Watcher.get (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3140:25)
at new Watcher (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:3129:12)
at mountComponent (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:2793:3)
at VueComponent.Object.<anonymous>.Vue.$mount (/home/juri/develop/management-system/node_modules/vue/dist/vue.runtime.common.js:7997:10)
at mount (/home/juri/develop/management-system/node_modules/#vue/test-utils/dist/vue-test-utils.js:5645:21)
at Object.test (/home/juri/develop/management-system/test/unit/specs/LandingPage.spec.js:26:21)
at Object.asyncJestTest (/home/juri/develop/management-system/node_modules/jest-jasmine2/build/jasmine_async.js:108:37)
at resolve (/home/juri/develop/management-system/node_modules/jest-jasmine2/build/queue_runner.js:56:12)
at new Promise (<anonymous>)
at mapper (/home/juri/develop/management-system/node_modules/jest-jasmine2/build/queue_runner.js:43:19)
at promise.then (/home/juri/develop/management-system/node_modules/jest-jasmine2/build/queue_runner.js:87:41)
at process.internalTickCallback (internal/process/next_tick.js:77:7)
● user-information.vue › is a Vue instance
TypeError: Cannot read property 'state' of undefined
at VueComponent.mappedState (node_modules/vuex/dist/vuex.common.js:793:31)
at Watcher.get (node_modules/vue/dist/vue.runtime.common.js:3140:25)
at Watcher.evaluate (node_modules/vue/dist/vue.runtime.common.js:3247:21)
at Proxy.computedGetter (node_modules/vue/dist/vue.runtime.common.js:3505:17)
at Proxy.render (src/renderer/components/User/user-information.vue:275:417)
at VueComponent.Vue._render (node_modules/vue/dist/vue.runtime.common.js:4542:22)
at VueComponent.updateComponent (node_modules/vue/dist/vue.runtime.common.js:2786:21)
at Watcher.get (node_modules/vue/dist/vue.runtime.common.js:3140:25)
at new Watcher (node_modules/vue/dist/vue.runtime.common.js:3129:12)
at mountComponent (node_modules/vue/dist/vue.runtime.common.js:2793:3)
at VueComponent.Object.<anonymous>.Vue.$mount (node_modules/vue/dist/vue.runtime.common.js:7997:10)
at init (node_modules/vue/dist/vue.runtime.common.js:4135:13)
at createComponent (node_modules/vue/dist/vue.runtime.common.js:5606:9)
at createElm (node_modules/vue/dist/vue.runtime.common.js:5553:9)
at VueComponent.patch [as __patch__] (node_modules/vue/dist/vue.runtime.common.js:6089:7)
at VueComponent.Vue._update (node_modules/vue/dist/vue.runtime.common.js:2658:19)
at VueComponent.updateComponent (node_modules/vue/dist/vue.runtime.common.js:2786:10)
at Watcher.get (node_modules/vue/dist/vue.runtime.common.js:3140:25)
at new Watcher (node_modules/vue/dist/vue.runtime.common.js:3129:12)
at mountComponent (node_modules/vue/dist/vue.runtime.common.js:2793:3)
at VueComponent.Object.<anonymous>.Vue.$mount (node_modules/vue/dist/vue.runtime.common.js:7997:10)
at mount (node_modules/#vue/test-utils/dist/vue-test-utils.js:5645:21)
at Object.test (test/unit/specs/LandingPage.spec.js:26:21)
Test Suites: 2 failed, 2 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 2.625s
Ran all test suites.
npm ERR! Test failed. See above for more details.
What can I do to solve this error and what is the source of it? As far as I can think of, it looks like it has something to do with Vuex, because it's complaining because of commit() and dispatch() (Vuex-functions). But I'm confused - I'm using no data which is stored in the store in my simple test.
It looks like you need to instantiate Vuex within the test.
Your component has this created() hook, so just by creating it you are referencing the vuex instance.
created() {
this.$store.commit('userStore/setDefaultUserStatus');
this.$store.dispatch('userStore/getAllUsers');
},
You can use createLocalVue() to get an isolated Vue instance, and add Vuex to it, then pass it via mountOptions to mount().
You can also mock the store so that other tests have control over the data.
import Vuex from 'vuex'
import { mount, createLocalVue } from '#vue/test-utils'
const localVue = createLocalVue()
localVue.use(Vuex)
const storeOptions = {
state: ...
getters: ...
mutations: ...
};
const mockStore = new Vuex.Store(storeOptions)
describe('user-information.vue', () => {
let wrapper;
beforeEach(() => {
const mountOptions = {
localVue,
store: mockStore
}
wrapper = mount(UserInformation, mountOptions)
});
test('is a Vue instance', () => {
expect(wrapper.isVueInstance()).toBeTruthy();
});
});
Related
I'm using Semantic-UI in my react project.
It works well. but sometimes it shows error in during unit testing with Jest.
This is the error message
console.error node_modules/semantic-ui-react/dist/commonjs/lib/debug.js:25
Semantic-UI-React could not enable debug.
console.error node_modules/semantic-ui-react/dist/commonjs/lib/debug.js:26
TypeError: Cannot read property 'debug' of undefined
at Object.<anonymous> (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/semantic-ui-react/dist/commonjs/lib/debug.js:22:33)
at Runtime._execModule (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:513:13)
at Runtime.requireModule (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:329:14)
at Runtime.requireModuleOrMock (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:405:19)
at Object.<anonymous> (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/semantic-ui-react/dist/commonjs/lib/index.js:77:14)
at Runtime._execModule (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:513:13)
at Runtime.requireModule (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:329:14)
at Runtime.requireModuleOrMock (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:405:19)
at Object.<anonymous> (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/semantic-ui-react/dist/commonjs/addons/Responsive/Responsive.js:43:12)
at Runtime._execModule (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:513:13)
at Runtime.requireModule (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:329:14)
at Runtime.requireModuleOrMock (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:405:19)
at Object.<anonymous> (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/semantic-ui-react/dist/commonjs/addons/Responsive/index.js:8:19)
at Runtime._execModule (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:513:13)
at Runtime.requireModule (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:329:14)
at Runtime.requireModuleOrMock (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:405:19)
at Object.<anonymous> (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/semantic-ui-react/dist/commonjs/index.js:7:19)
at Runtime._execModule (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:513:13)
at Runtime.requireModule (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:329:14)
at Runtime.requireModuleOrMock (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:405:19)
at Object.<anonymous> (/home/ubuntu/work/node/suite/suite-cloud-app/client/src/FamilyViewWithController/index.js:4:24)
at Runtime._execModule (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:513:13)
at Runtime.requireModule (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:329:14)
at Runtime.requireModuleOrMock (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:405:19)
at Object.<anonymous> (/home/ubuntu/work/node/suite/suite-cloud-app/client/src/FamilyViewWithController/index.test.js:1:232)
at Runtime._execModule (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:513:13)
at Runtime.requireModule (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/node_modules/jest-runtime/build/index.js:329:14)
at jasmine2 (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-jasmine2/build/index.js:97:11)
at runTest (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/build/runTest.js:85:10)
at module.exports (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/jest-cli/build/TestWorker.js:87:5)
at handle (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/worker-farm/lib/child/index.js:44:8)
at process.<anonymous> (/home/ubuntu/work/node/suite/suite-cloud-app/client/node_modules/worker-farm/lib/child/index.js:51:3)
at emitTwo (events.js:126:13)
at process.emit (events.js:214:7)
at emit (internal/child_process.js:772:12)
at _combinedTickCallback (internal/process/next_tick.js:141:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
It's very wierd.
- sometimes it appears, sometimes it doesn't
- sometimes it appears in a component, sometimes it doesn't appear in that component.
- it doesn't appear with small amount of components. but it appears with a lot of components.
- but the tests always are passed even if this issue appears.
The test command that I'm using is
CI=true NODE_ENV=test react-scripts test --env=jsdom --no-cache
any thoughts about that? I do want your team to solve this issue or let me know how to fix it.
Regards.
It's a bug, was fixed in https://github.com/Semantic-Org/Semantic-UI-React/pull/3485 and released in 0.86.0.
I'm getting this error when I call a web service in C#: "The remote server returned an error: (407) Proxy Authentication Required". I reference some topic but issue not fixed.
I was added in my .cs code before call ws function:
WebProxy proxy = new WebProxy("http://doamin:9001", true);
proxy.Credentials = new NetworkCredential("user", "pass");
WebRequest.DefaultWebProxy = proxy;
And in config I added in <configuration> tag:
<system.net>
<defaultProxy useDefaultCredentials="true" >
<proxy usesystemdefault="False"
proxyaddress="http://doamin:9001"
bypassonlocal="True"
autoDetect="False" />
</defaultProxy>
</system.net>
After added some code I got another error: "The remote server returned an error 403 forbidden".
Please help me or give me an advice for this issue.
Thanks.
I recently upgraded ember 1.9 to 1.10 and get this:
DEPRECATION: ComputedProperty.cacheable() is deprecated. All computed properties are cacheable by default.
however I don't see any uses of this in my code. I'm in an ember cli 0.12.0 project
bower
{
"name": "proj",
"dependencies": {
"jquery": "^1.11.1",
"ember": "1.10.0",
"ember-data": "1.0.0-beta.12",
"ember-resolver": "~0.1.11",
"loader.js": "ember-cli/loader.js#1.0.1",
"ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "rwjblue/ember-cli-test-loader#0.0.4",
"ember-load-initializers": "ember-cli/ember-load-initializers#0.0.2",
"ember-qunit": "0.1.8",
"ember-qunit-notifications": "0.0.4",
"qunit": "~1.15.0"
}
}
Stacktrace:
DEPRECATION: ComputedProperty.cacheable() is deprecated. All computed properties are cacheable by default.
at Descriptor.ComputedPropertyPrototype.cacheable (http://localhost:4201/assets/vendor.js:21101:13)
at http://localhost:4201/assets/vendor.js:73759:10
at requireModule (http://localhost:4201/assets/vendor.js:64433:29)
at reify (http://localhost:4201/assets/vendor.js:64404:22)
at requireModule (http://localhost:4201/assets/vendor.js:64432:17)
at reify (http://localhost:4201/assets/vendor.js:64404:22)
at requireModule (http://localhost:4201/assets/vendor.js:64432:17)
at http://localhost:4201/assets/vendor.js:77306:14
at http://localhost:4201/assets/vendor.js:77307:4
seems to print the dep when this line runs at the ember data loading..
reified = reify(mod.deps, name, seen[name]); at 64432
Moving to both bower and package
"ember-data": "1.0.0-beta.14.1"
fixes this issue
When I try to use email features of my otherwise successfully deployed Rails 4 application, I get this error:
ActionView::Template::Error (Invalid :protocol option: 0):
Here is the log of that request:
app[web.1]: Started POST "/users" for 000.000.000.00 at 2014-08-14 21:37:43 +0000
heroku[router]: at=info method=POST path="/users" host=myapp-staging.heroku.com request_id=ef867e68-3f4d-4b3e- a6bb-83c288e893db fwd="000.000.000.00" dyno=web.1 connect=2ms service=746ms status=500 bytes=1676
app[web.1]: Rendered devise/mailer/confirmation_instructions.html.erb (1.5ms)
app[web.1]:
app[web.1]: ActionView::Template::Error (Invalid :protocol option: 0):
app[web.1]: 2:
app[web.1]: 3: <p>You can confirm your account email through the link below:</p>
app[web.1]: 4:
app[web.1]: 5: <p><%= link_to 'Confirm my account', confirmation_url(#resource, confirmation_token: #token) %></p>
app[web.1]: app/views/devise/mailer/confirmation_instructions.html.erb:5:in `_app_views_devise_mailer_confirmation_instructions_html_erb___2108085566880241107_70117259868780'
app[web.1]:
app[web.1]:
app[web.1]: Completed 500 Internal Server Error in 723ms
This is in my environment.rb
ActionMailer::Base.smtp_settings = {
:address => 'smtp.sendgrid.net',
:port => '587',
:authentication => :plain,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => 'heroku.com',
:enable_starttls_auto => true
}
This is in my production.rb:
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { host: :'myapp-staging.herokuapp.com' }
config.action_mailer.default :charset => "utf-8"
As you can see, I'm using the SendGrid addon. Has anyone seen this error and could you point me toward a potential solution?
I figured it out. I'd entered an errant semi colon. The value of
config.action_mailer.default_url_options in production.rb should read thusly:
config.action_mailer.default_url_options = { host: 'helloworkout-staging.herokuapp.com' }
I've created a window application which will make an http get request using the following code
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet("http://www.google.com");
HttpResponse response = client.execute(request);
BufferedReader rd = new BufferedReader
(new InputStreamReader(response.getEntity().getContent()));
String line = "";
while ((line = rd.readLine()) != null) {
result = result + line;
}
} catch (IOException ex) {
JOptionPane.showMessageDialog(null,ex.getCause());
}
return result;.
The variable 'result' is a String and I've used these packages
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
This code works perfect. But, I wanted to use this code in a web service. I copied and pasted the same code in the web service, but received the following error.
Exception in thread "AWT-EventQueue-0" javax.xml.ws.soap.SOAPFaultException: org/apache/commons/logging/LogFactory
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:119)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:129)
at $Proxy30.identifyThisSong(Unknown Source)`Caused by: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.apache.http.impl.client.AbstractHttpClient.<init>(AbstractHttpClient.java:187)
at org.apache.http.impl.client.DefaultHttpClient.<init>(DefaultHttpClient.java:146)
at com.raghuvenmarathoor.songIdentify.SongIdentify.identifyThisSong(SongIdentify.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:95)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:295)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:515)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:285)
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:143)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:155)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:189)
at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:76)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)`
I am new to web services. I've googled a lot about this problem, but couldn't find any relevant result(Most of the results were about using http get request to access web services). This is what I am trying to achieve :
Access a web service
Web service should access information from another website using http get request.
return the value retrieved from http get request to my client application.
Any references or alternate ways or suggestions would be hugely helpful..
Thanks in advance
Raghu