my tsconfig.spec.json
"paths": {
"#test/*": ["tests/*"],
"#capacitor/*": ["tests/src/mocks/capacitor/*"]
}
I have a Camera.ts file located under tests/src/mocks/capacitor/camera.ts which implements the CameraPlugin from Capacitor.
still, when doing any tests i receive the "not implemented on web"
An error was thrown in afterAll
Unhandled promise rejection: Error: Not implemented on web.
error properties: Object({ code: 'UNIMPLEMENTED' })
somebody know what i am missing?
Appreciate!
Have you declared "paths" in the correct place? It should be set inside "compilerOptions"
here's an example tsconfig.spec.json file.
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine",
"node"
],
"paths": {
"#capacitor/*": ["__mocks__/#capacitor/*"],
"#capacitor-community/*":["__mocks__/#capacitor-community/*"]
}
},
"files": [
"src/test.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
Related
In my react project when I use in:
//package.json
"name": "app"
then intellisense is not working for absolute path imports
//SomeComponent.js
import {StorageKeys} from 'app/Constants' // inellisense don't work
import {StorageKeys} from '../../Constants' // intellisense works
Tried some suggestions regarding "jsconfig.json" and setting compiler's base url but with no success.
Any Idea?
{
"compilerOptions": {
"target": "ES6",
"baseUrl": "./",
"paths" : {
"app/*" : ["./*"]
}
},
"exclude": [
"node_modules",
"**/node_modules/*"
]
}
Eslint stops working yet again..
{
"extends": ["airbnb"],
"root": true,
"parser": "babel-eslint",
"env": {
"browser": true
},
"plugins": [
"react-hooks",
"react"
],
"rules": {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
Using VSCODE Version: 1.47.0-insider
useEffect(() => {
someVarOutside
}, []);
The above should warn that someVarOutside is missing from dep array. react-hooks was working. Now it is not.
I would like to remove the #babel/plugin-proposal-class-properties plugin as we are now targeting chrome 79 which supports class properties. I would imagine that removing this plugin shouldn't be a problem because we no longer need babel to transpile that code.
When I remove the plugin from the plugins section of the babelrc file, I am getting an error -
Module build failed (from ./node_modules/babel-loader/lib/index.js), ...
"Support for the experimental syntax 'classProperties' isn't currently enabled "
Relevant Package.json entries:
"#babel/core": "^7.0.0",
"#babel/preset-env": "^7.0.0",
"webpack": "4.40.0",
Here is my .babelrc file
{
"presets": [
"#babel/preset-react",
[
"#babel/preset-env",
{
"targets": {
"chrome": 79
}
}
],
"#babel/preset-typescript"
],
"plugins": [
"babel-plugin-styled-components"
]
}
Here is my webpack config, relevant loader configuration:
{
test: /\.(js(x)?|ts(x)?)$/,
exclude: [/node_modules/],
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true
}
}
]
},
Any help or insight would be appreciated.
Getting exception and warning while uploading and package extension of Build Task.
I make a build task plugin i use below manifest file
{
"id": "sample-custom-build-task",
"type": "ms.vss-distributed-task.task",
"description": "Adds sample type Build Task",
"targets": [
"ms.vss-distributed-task.tasks"
],
"properties": {
"name": "buildtask"
}
}
Buildtask is a folder in home directory that contains node_modules,task.json,tsconfig,package.json and task image file.
tsConfig.json is look like this.
{
"compilerOptions":
{
"target": "es6",
"module": "commonjs",
"lib": ["es2015"],
"allowJs": true,
"checkJs": true,
"sourceMap": true,
"removeComments": true,
"strict": true,
"noImplicitAny": false,
"moduleResolution": "node",
"typeRoots": ["node_modules/typings"],
"types": ["node"]
},
"exclude": [
"**/node_modules/*",
"/NodeExecutor.ts"
],
"enableAutoDiscovery":true
}
Whenever i package my plugin there is some warning on console.
Refer image
and upload an extension show this error
Strange, for me, in past i make build task plugin but no error and warning whenever i add node_modules in my package it gave me error.
What i going to wrong, i add whole build task folder in my manifest file.
Thanks in advance.
Remove "addressable": true code for BuildTask:
"files": [
{
"path": "logo.png",
"addressable": true
},
{
"path": "BuildTask"
}
]
Also, the BuildTask folder should contains task.json file.
I know there were similar questions but none of them solved my problem.
When I run karma test it throws the following error, every time it tries to load a module, that was shimmed with browserify-shim:
TypeError: 'undefined' is not an object (evaluating 'module.exports = ex')
at /tmp/8ff1e03f7ba1f9c70ee4192510d267a2.browserify:3855:0 <- lib/underscore/underscore.js:1421:0
My karma.conf.js is the following:
module.exports = function(karma) {
karma.set({
frameworks: [ 'jasmine', 'browserify' ],
files: [
'test/spec/**/*Spec.js'
],
reporters: [ 'dots' ],
preprocessors: {
'test/spec/**/*Spec.js': [ 'browserify' ]
},
browsers: [ 'PhantomJS' ],
logLevel: 'LOG_DEBUG',
singleRun: true,
autoWatch: false,
// browserify configuration
browserify: {
debug: true,
transform: [ 'reactify', 'browserify-shim' ]
}
});
};
And here is the relevant part of my package.json file:
...
"browser": {
"underscore": "./lib/underscore/underscore.js",
"jquery": "./lib/jquery/dist/jquery.js",
"typeahead": "./lib/bootstrap3-typeahead/bootstrap3-typeahead.js",
"bootstrap": "./lib/bootstrap/dist/js/bootstrap.js",
"q": "./lib/q/q.js"
},
"browserify-shim": {
"underscore": "_",
"jquery": "jQuery",
"typeahead": {
"depends": [
"jquery"
]
}
},
"browserify": {
"transform": [
"browserify-shim"
]
},
....
Any idea what can caus the problem?
I had the same problem and have resolved it by removing the browserify-shim transform from karma configuration file, since it is already declared as a transform on package.json file.
Hope that helps.