Unable to subscribe with Amplify - aws-appsync

I'm getting this error message while trying to subscribe using amplify. The error message does not make sense. I am not sure what variable it is referring to. I"ve push all my changes up again to make sure but still the same.
subscription.current = API.graphql(
graphqlOperation(subscriptions.onCreatePurchasedPackage, {
owner: userInfo.userName,
authMode: "AMAZON_COGNITO_USER_POOLS",
})
);
observable.current = await subscription.current.subscribe({
next: ({ provider, value }) =>
console.log({
"onCreatePurchasedPackage changed the provider": provider,
"the value": value,
}),
error: (error) => console.warn(error),
});
"Validation error of type UndefinedVariable: variable not found"
"dependencies": {
"#aws-amplify/ui-react": "^3.2.0",
"#testing-library/jest-dom": "^5.16.4",
"#testing-library/react": "^13.3.0",
"#testing-library/user-event": "^13.5.0",
"#types/jest": "^27.5.2",
"#types/node": "^16.11.45",
"#types/react": "^18.0.15",
"#types/react-dom": "^18.0.6",
"aws-amplify": "^4.3.27",
"aws-appsync": "^4.1.7",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.33.1",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"typescript": "^4.7.4",
"web-vitals": "^2.1.4"
},

Related

BigCommerce NPM - Update Babel

I am trying to run an older BigCommerce site locally but none of the JavaScript is working on the local site. Console seems to indicate an issue with Babel.
This is what is in the error log:
Error: Module build failed: TypeError: /Users/liam/Desktop/BigCommerce/KBBC+V1.4+(March+2020)-1.11.0/assets/js/theme/global/quick-search.js: Cannot read property 'has' of undefined
at resolvePath (/Users/liam/Desktop/BigCommerce/KBBC+V1.4+(March+2020)-1.11.0/node_modules/babel-plugin-lodash/lib/importModule.js:22:24)
at importModule (/Users/liam/Desktop/BigCommerce/KBBC+V1.4+(March+2020)-1.11.0/node_modules/babel-plugin-lodash/lib/importModule.js:36:53)
at memoized (/Users/liam/Desktop/BigCommerce/KBBC+V1.4+(March+2020)-1.11.0/node_modules/lodash/memoize.js:62:23)
at /Users/liam/Desktop/BigCommerce/KBBC+V1.4+(March+2020)-1.11.0/node_modules/babel-plugin-lodash/lib/index.js:217:63
at arrayEach (/Users/liam/Desktop/BigCommerce/KBBC+V1.4+(March+2020)-1.11.0/node_modules/lodash/_arrayEach.js:15:9)
at forEach (/Users/liam/Desktop/BigCommerce/KBBC+V1.4+(March+2020)-1.11.0/node_modules/lodash/forEach.js:38:10)
at /Users/liam/Desktop/BigCommerce/KBBC+V1.4+(March+2020)-1.11.0/node_modules/babel-plugin-lodash/lib/index.js:193:30
at arrayEach (/Users/liam/Desktop/BigCommerce/KBBC+V1.4+(March+2020)-1.11.0/node_modules/lodash/_arrayEach.js:15:9)
at forEach (/Users/liam/Desktop/BigCommerce/KBBC+V1.4+(March+2020)-1.11.0/node_modules/lodash/forEach.js:38:10)
at /Users/liam/Desktop/BigCommerce/KBBC+V1.4+(March+2020)-1.11.0/node_modules/babel-plugin-lodash/lib/index.js:181:28
This is what is in the package.json file. I've changed the Stencil CLI to 6.3.0 as per BC's instructions but doesn't seem to be the issue this time.
"name": "bigcommerce-cornerstone",
"description": "The BigCommerce reference theme for the Stencil platform",
"version": "6.3.0",
"private": true,
"author": "BigCommerce",
"license": "MIT",
"dependencies": {
"#bigcommerce/stencil-utils": "^1.0.10",
"async": "^2.5.0",
"babel-polyfill": "^6.26.0",
"easyzoom": "^2.5.0",
"fastclick": "^1.0.6",
"foundation-sites": "^5.5.3",
"html5-history-api": "^4.2.7",
"jquery": "^2.2.4",
"jstree": "vakata/jstree",
"lazysizes": "3.0.0",
"lodash": "^4.17.4",
"nod-validate": "^2.0.12",
"pace": "hubspot/pace#a03f1f1de62c9cea6c88b2267b8d7a83858b6cb6",
"slick-carousel": "^1.8.1",
"sweetalert2": "^6.10.1"
},
"devDependencies": {
"#bigcommerce/citadel": "^2.15.1",
"#babel/core": "^7.12.17",
"babel-eslint": "^8.0.1",
"babel-loader": "^7.1.2",
"babel-plugin-dynamic-import-webpack": "^1.0.1",
"babel-plugin-lodash": "^3.2.11",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-regenerator": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.2.2",
"clean-webpack-plugin": "^0.1.17",
"core-js": "^2.5.0",
"es6-shim": "^0.35.3",
"eslint": "^4.8.0",
"eslint-config-airbnb": "^16.0.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.4.0",
"grunt": "^1.0.1",
"grunt-eslint": "^20.0.0",
"grunt-karma": "^2.0.0",
"grunt-scss-lint": "^0.5.0",
"grunt-svgstore": "^1.0.0",
"jasmine-core": "^2.2.0",
"karma": "^1.7.0",
"karma-babel-preprocessor": "^7.0.0",
"karma-coverage": "^1.1.1",
"karma-es6-shim": "^1.0.0",
"karma-jasmine": "^1.1.0",
"karma-phantomjs-launcher": "^1.0.4",
"karma-sourcemap-loader": "0.3.7",
"karma-verbose-reporter": "0.0.6",
"karma-webpack": "^2.0.4",
"load-grunt-config": "^0.19.2",
"lodash-webpack-plugin": "^0.11.2",
"regenerator-runtime": "^0.11.0",
"time-grunt": "^1.2.2",
"uglify-js": "^3.0.28",
"webpack": "^3.6.0"
}
}
Running node version 12.22.2, npm 8.6.0, stencil cli 6.3.0
I think this is the same issue I got when a folder was named with special characters. Try deleting everything in your directory name after KBBC.
Change
KBBC+V1.4+(March+2020)-1.11.0
To
KBBC
You may also want to change the "name" value in config.json.

Invalid descriptor with yarn berry Github subdirectory install

I need to install a subdirectory of a remote repository as my node dependency.
According to this issue, it is possible to install subdirectories of GitHub repositories as dependencies with yarn 2.x.x https://github.com/yarnpkg/yarn/issues/4725
However, running yarn add https://github.com/mklueh/gridsome/tree/master/gridsome.git produces
Internal Error: Invalid descriptor (git+https://github.com/mklueh/gridsome/tree/master/gridsome.git)
at Module.x (C:\Users\MyPc\Workspace\myproject\.yarn\releases\yarn-2.4.1.cjs:2:435195)
at C:\Users\MyPc\Workspace\myproject\.yarn\releases\yarn-2.4.1.cjs:2:30958
at Array.map (<anonymous>)
at M.execute (C:\Users\MyPc\Workspace\myproject\.yarn\releases\yarn-2.4.1.cjs:2:30866)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async M.validateAndExecute (C:\Users\MyPc\Workspace\myproject\.yarn\releases\yarn-2.4.1.cjs:2:660570)
at async Y.run (C:\Users\MyPc\Workspace\myproject\.yarn\releases\yarn-2.4.1.cjs:17:3854)
at async Y.runExit (C:\Users\MyPc\Workspace\myproject\.yarn\releases\yarn-2.4.1.cjs:17:4021)
at async h (C:\Users\MyPc\Workspace\myproject\.yarn\releases\yarn-2.4.1.cjs:2:285303)
at async r (C:\Users\MyPc\Workspace\myproject\.yarn\releases\yarn-2.4.1.cjs:2:283914)
This is the package.json of the submodule.
{
"version": "0.7.23",
"name": "gridsome",
"description": "A JAMstack framework for building blazing fast websites with Vue.js",
"homepage": "https://gridsome.org",
"repository": "https://github.com/gridsome/gridsome",
"bugs": "https://github.com/gridsome/gridsome/issues",
"license": "MIT",
"main": "index.js",
"browser": "app/index.js",
"bin": {
"gridsome": "./bin/gridsome.js"
},
"keywords": [
"vue",
"gridsome",
"static site generator",
"jamstack",
"website",
"blog"
],
"dependencies": {
"#babel/code-frame": "^7.5.5",
"#babel/core": "^7.0.0",
"#gridsome/cli": "^0.3.4",
"#hapi/joi": "^15.1.1",
"#sindresorhus/slugify": "^1.1.0",
"#vue/babel-preset-app": "^4.2.2",
"#vue/component-compiler-utils": "^2.5.2",
"address": "^1.1.0",
"auto-bind": "^2.0.0",
"autoprefixer": "^9.4.7",
"babel-loader": "8.0.5",
"cache-loader": "^2.0.1",
"camelcase": "^5.0.0",
"case-sensitive-paths-webpack-plugin": "^2.2.0",
"chalk": "^2.4.2",
"chokidar": "^3.4.2",
"color-string": "^1.5.3",
"columnify": "^1.5.4",
"connect-history-api-fallback": "^1.6.0",
"core-js": "^3.6.4",
"css-loader": "^2.1.0",
"devcert": "^1.1.0",
"dotenv": "^6.2.0",
"enhanced-resolve": "4.1.1",
"eventemitter3": "^3.1.0",
"express": "^4.16.4",
"express-graphql": "^0.12.0",
"fastest-levenshtein": "^1.0.12",
"file-loader": "^3.0.1",
"friendly-errors-webpack-plugin": "^1.7.0",
"fs-extra": "^7.0.1",
"globby": "^9.0.0",
"graphql": "^15.5.0",
"graphql-compose": "7.20.1",
"graphql-playground-middleware-express": "^1.7.12",
"hash-sum": "^1.0.2",
"hirestime": "^3.2.1",
"html-webpack-plugin": "^3.2.0",
"invariant": "^2.2.4",
"is-relative": "^1.0.0",
"is-url": "^1.2.4",
"jest-worker": "24.0.0",
"json-loader": "^0.5.7",
"loader-utils": "^1.2.3",
"lodash": "^4.17.11",
"lokijs": "^1.5.6",
"lru-cache": "^5.1.1",
"md5-file": "^4.0.0",
"mime-types": "^2.1.21",
"mini-css-extract-plugin": "^0.5.0",
"moment": "^2.24.0",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"p-map": "^2.0.0",
"path-to-regexp": "^2.2.1",
"physical-cpu-count": "^2.0.0",
"pnp-webpack-plugin": "^1.6.4",
"portfinder": "^1.0.20",
"postcss-loader": "^3.0.0",
"potrace": "^2.1.8",
"probe-image-size": "^4.0.0",
"resolve-from": "^5.0.0",
"sharp": "^0.28.1",
"slash": "^2.0.0",
"sockjs": "^0.3.19",
"sockjs-client": "^1.3.0",
"stack-trace": "^0.0.10",
"svgo": "^2.2.2",
"tapable": "2.0.0-beta.5",
"url-loader": "^1.1.2",
"vue": "^2.6.10",
"vue-loader": "^15.7.1",
"vue-meta": "^2.2.2",
"vue-router": "^3.1.3",
"vue-server-renderer": "^2.6.10",
"vue-style-loader": "^4.1.2",
"vue-template-compiler": "^2.6.10",
"webpack": "^4.29.3",
"webpack-chain": "^5.2.0",
"webpack-dev-middleware": "^3.5.2",
"webpack-hot-middleware": "^2.24.3",
"webpack-merge": "^4.2.1",
"yaml-loader": "^0.5.0"
},
"peerDependencies": {
"less-loader": "*",
"sass-loader": "*",
"stylus-loader": "*"
},
"peerDependenciesMeta": {
"sass-loader": {
"optional": true
},
"less-loader": {
"optional": true
},
"stylus-loader": {
"optional": true
}
},
"engines": {
"node": ">=8.3"
},
"contributors": [
{
"name": "Tommy Vedvik (#tomtev)"
},
{
"name": "Hans-Jørgen Vedvik (#hjvedvik)"
}
]
}
What is going wrong here? Does the remote repository need adjustments to work with yarn 2?

facing error TS2339: Property 'then' does not exist on type 'StepDefinitions & Hooks'

facing error TS2339: Property 'then' does not exist on type 'StepDefinitions & Hooks'.
when I am trying to run tsc -w
tried all the solution which I know but nothing is working out.
Feature file:
Feature: Login creation for Amazon AWS
Scenario: Successful creation of Login
Given User navigate to Home Page
When User enter email and other details
Then Login is created sucessfully
Package.json
{
"name": "package.json",
"version": "1.0.0",
"description": "package",
"main": "index.js",
"dependencies": {
"#types/node": "^12.7.5"
},
"scripts": {
"test": "./node_modules/.bin/cucumber-js -p default"
},
"compilerOptions": {
"target": "es6"
},
"devDependencies": {
"#types/chai": "^4.2.2",
"#types/cucumber": "^4.0.7",
"chai": "^4.2.0",
"cucumber": "^5.1.0",
"cucumber-pretty": "^1.5.2",
"cucumber-tsflow": "^3.2.0",
"exceljs": "^2.0.1",
"protractor": "^5.4.2",
"protractor-cucumber-framework": "^6.1.3",
"ts-node": "^8.3.0",
"typescript": "^3.6.3",
"xlsx": "^0.15.1"
},
"author": "Bharani",
"license": "ISC"
}
Step Definition file:
import { Given, When, Then } from "cucumber"
Given("User navigate to Home Page", function(){
console.log("hafd");
});
When("User enter email and other details",function(){
console.log("dfhagsdf");
});
Then("Login is created sucessfully",function(){
console.log("dhfhd");
});
Package.json:
{
"name": "package.json",
"version": "1.0.0",
"description": "package",
"main": "index.js",
"dependencies": {
"#types/node": "^12.7.5"
},
"scripts": {
"test": "./node_modules/.bin/cucumber-js -p default"
},
"compilerOptions": {
"target": "es6"
},
"devDependencies": {
"#types/chai": "^4.2.2",
"#types/cucumber": "^4.0.7",
"chai": "^4.2.0",
"cucumber": "^5.1.0",
"cucumber-pretty": "^1.5.2",
"cucumber-tsflow": "^3.2.0",
"exceljs": "^2.0.1",
"protractor": "^5.4.2",
"protractor-cucumber-framework": "^6.1.3",
"ts-node": "^8.3.0",
"typescript": "^3.6.3",
"xlsx": "^0.15.1"
},
"author": "Bharani",
"license": "ISC"
}
Error in console:
'''[16:44:58] Starting compilation in watch mode...
POM_TS_CUCUMBER/Featurefile/stepdefinition/Steps.ts:3:32 - error
TS2339: Property 'then' does not exist on type 'StepDefinitions &
Hooks'.
3 defineSupportCode(({Given,When,then}) =>{
~~~~
[16:45:04] Found 1 error. Watching for file changes. '''
You have written Then in feature file which is not from the cucumber library. Try writing then statement again from cucumber library and try again.

ngrx/effects type inference error

I'm trying to implement an authentication functionality using effects. These are the relevant classes
// auth.actions.ts
import { Action } from '#ngrx/store';
import { AuthVM, ParamsVM } from '../models';
import { Credential } from '../interfaces';
export const FETCH_AUTH_INFO = 'FETCH_AUTH_INFO';
export const AUTHENTICATE_WITHOUT_CREDENTIALS = 'AUTHENTICATE_WITHOUT_CREDENTIALS';
export class FetchAuthInfo implements Action {
readonly type = FETCH_AUTH_INFO;
constructor(public payload = undefined) { }
}
export class AuthenticateWithoutCredentials implements Action {
readonly type = AUTHENTICATE_WITHOUT_CREDENTIALS;
constructor(public payload: ParamsVM = undefined) { }
}
export type AuthActions = FetchAuthInfo | AuthenticateWithoutCredentials;
#
// auth.effects.ts
import { Injectable } from "#angular/core";
import { Actions, Effect } from '#ngrx/effects';
import { Observable } from 'rxjs/Observable';
import { Action } from '#ngrx/store';
import * as fromAuthActions from './auth.actions';
import { Storage } from '#ionic/storage';
import { fromPromise } from "rxjs/observable/fromPromise";
import { AuthVM, ParamsVM } from '../models';
import { of } from 'rxjs/observable/of';
import { AuthInfoFetched, AuthenticateWithoutCredentials} from './auth.actions';
#Injectable()
export class AuthEffects {
constructor(
private actions$: Actions,
private storage: Storage
) { }
#Effect() fetchAuthInfo$: Observable<Action> = this.actions$
.ofType(fromAuthActions.FETCH_AUTH_INFO)
.mergeMap(() => fromPromise(this.storage.get('authInfo')))
.mergeMap((data: AuthVM) => {
if (data) {
return of(new AuthInfoFetched(data));
} else {
return of(new AuthenticateWithoutCredentials());
}
});
}
I'm getting this error:
The type argument for type parameter 'R' cannot be inferred from the usage. Consider specifying the type
arguments explicitly. Type argument candidate 'AuthInfoFetched' is not a valid type argument because it is
not a supertype of candidate 'AuthenticateWithoutCredentials'. Types of property 'type' are incompatible.
Type '"AUTHENTICATE_WITHOUT_CREDENTIALS"' is not assignable to type '"AUTH_INFO_FETCHED"'.
As far as I know, an Action Observable should be returned at the end of the operators chain. I can't understand why I'm getting the error since AuthInfoFetched and AuthenticateWithoutCredentials both implement the Action interface.
This is the package.json file if it is of any use
{
"name": "app",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"#angular/common": "^4.4.6",
"#angular/compiler": "^4.4.6",
"#angular/compiler-cli": "^4.4.6",
"#angular/core": "^4.4.6",
"#angular/forms": "^4.4.6",
"#angular/http": "^4.4.6",
"#angular/platform-browser": "^4.4.6",
"#angular/platform-browser-dynamic": "^4.4.6",
"#ionic-native/admob-free": "^4.4.2",
"#ionic-native/core": "3.12.1",
"#ionic-native/splash-screen": "3.12.1",
"#ionic-native/status-bar": "3.12.1",
"#ionic/app-scripts": "2.1.3",
"#ionic/storage": "2.0.1",
"#ngrx/effects": "^4.1.1",
"#ngrx/store": "^4.1.1",
"#ngrx/store-devtools": "^4.1.1",
"body-parser": "^1.18.2",
"cordova-admob-sdk": "^0.11.1",
"cordova-android": "^6.4.0",
"cordova-plugin-admob-free": "^0.11.0",
"cordova-plugin-console": "^1.1.0",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-splashscreen": "^4.1.0",
"cordova-plugin-statusbar": "^2.3.0",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-promise-polyfill": "0.0.2",
"cordova-sqlite-storage": "^2.1.2",
"cors": "^2.8.4",
"express": "^4.16.2",
"ionic-angular": "3.6.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"morgan": "^1.9.0",
"rxjs": "5.4.3",
"sw-toolbox": "3.6.0",
"typescript": "2.3.4",
"zone.js": "0.8.12"
},
"devDependencies": {
"ionic": "3.19.1"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-sqlite-storage": {},
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-admob-free": {}
},
"platforms": [
"android"
]
}
}
Any help would be much appreciated.
In the effect you are returning two different types of action using if/else, so the type can not be inferred for the effect. you can use rxjs if operator or use a temp variable. note ngrx now uses pipes with rxjs 6
Here is code showing different ways
//one way
#Effect() fetchAuthInfo$: Observable<Action> = this.actions$
.ofType(fromAuthActions.FETCH_AUTH_INFO)
.map(() => fromPromise(this.storage.get('authInfo')))
.switchMap((data: AuthVM) => {
let result;
if (data) {
result = of(new AuthInfoFetched(data));
} else {
result = of(new AuthenticateWithoutCredentials());
}
return result;
});
//second way
#Effect() fetchAuthInfo$: Observable<Action> = this.actions$
.ofType(fromAuthActions.FETCH_AUTH_INFO)
.map(() => fromPromise(this.storage.get('authInfo')))
.switchMap((data: AuthVM) => Observable.if(() => data,
of(new AuthInfoFetched(data)),
of(new AuthenticateWithoutCredentials())
)
);
//the new effect way in ngrx
#Effect() fetchAuthInfo$ = this.actions$.pipe(
ofType(fromAuthActions.FETCH_AUTH_INFO),
map(() => fromPromise(this.storage.get('authInfo'))),
switchMap((data: AuthVM) => iif(() => data,
of(new AuthInfoFetched(data)),
of(new AuthenticateWithoutCredentials()))
)
);
I also got it working typecasting the returned values to the "Action" type
#Effect() fetchAuthInfo$: Observable<Action> = this.actions$
.ofType(FETCH_AUTH_INFO)
.mergeMap(() => fromPromise(this.storage.get('authInfo')))
.mergeMap((data: AuthVM) => {
if (data) {
return of(<Action>new AuthInfoFetched(data));
} else {
return of(<Action>new AuthenticateWithoutCredentials());
}
});

using protractor-cucumber-framework for testing it gives this error

Hello friends i testing my angular 2 app using protractor and cucumber js but it give me this error i try several solution for this issue but no one can solve my issue.if you know any sol it would be great thank u..
[1] Unhandled rejection TypeError: this.registerHandler is not a function
[1] at Object.registerHandlers (/home/ca1/WebstormProjects/DME/node_modules/protractor-cucumber-framework/lib/resultsCapturer.js:16:8)
[1] at /home/ca1/WebstormProjects/DME/node_modules/protractor-cucumber-framework/lib/resultsCapturer.js:6:22
[1] at Object.defineSupportCode (/home/ca1/WebstormProjects/DME/node_modules/cucumber/src/support_code_library_builder/index.js:20:9)
[1] at Object. (/home/ca1/WebstormProjects/DME/node_modules/protractor-cucumber-framework/lib/resultsCapturer.js:5:12)
[1] at Module._compile (module.js:570:32)
[1] at Object.Module._extensions..js (module.js:579:10)
[1] at Module.load (module.js:487:32)
[1] at tryModuleLoad (module.js:446:12)
[1] at Function.Module._load (module.js:438:3)
[1] at Module.require (module.js:497:17)
[1] at require (internal/module.js:20:19)
[1] at /home/ca1/WebstormProjects/DME/node_modules/cucumber/src/cli/index.js:61:42
[1] at Array.forEach (native)
[1] at Cli.getSupportCodeLibrary (/home/ca1/WebstormProjects/DME/node_modules/cucumber/src/cli/index.js:61:22)
[1] at Cli. (/home/ca1/WebstormProjects/DME/node_modules/cucumber/src/cli/index.js:76:37)
[1] at next (native)
[1] [17:30:50] E/launcher - BUG: launcher exited with 1 tasks remaining
here is my package.json
{
"name": "dpt-angular",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented with testing support",
"scripts": {
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
"e2e": "concurrently \"http-server -s\" \"protractor protractor.config.js\" --kill-others --success first",
"lint": "tslint ./app/**/*.ts -t verbose",
"lite": "lite-server",
"pree2e": "webdriver-manager update",
"test": "concurrently \"tsc -w\" \"karma start karma.conf.js\"",
"test-once": "karma start karma.conf.js --single-run",
"tsc": "tsc",
"tsc:w": "tsc -w"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"#angular/common": "~2.4.0",
"#angular/compiler": "~2.4.0",
"#angular/core": "~2.4.0",
"#angular/forms": "~2.4.0",
"#angular/http": "~2.4.0",
"#angular/platform-browser": "~2.4.0",
"#angular/platform-browser-dynamic": "~2.4.0",
"#angular/router": "~3.4.0",
"#types/file-saver": "0.0.1",
"angular-in-memory-web-api": "~0.2.4",
"angular2-moment": "^1.1.0",
"core-js": "^2.4.1",
"mydatepicker": "^2.0.25",
"ng2-completer": "^1.5.2",
"ng2-file-upload": "^1.2.1",
"ng2-pdf-viewer": "^1.1.0",
"rxjs": "5.0.1",
"systemjs": "0.19.40",
"zone.js": "^0.7.4"
},
"devDependencies": {
"#types/jasmine": "^2.5.36",
"#types/node": "^6.0.46",
"canonical-path": "0.0.2",
"concurrently": "^3.1.0",
"cucumber": "^3.0.0",
"cucumber-tsflow": "^2.2.0",
"http-server": "^0.9.0",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"lite-server": "^2.2.2",
"lodash": "^4.16.4",
"protractor": "^4.0.14",
"protractor-cucumber-framework": "^3.0.0",
"rimraf": "^2.5.4",
"ts-node": "^3.3.0",
"tslint": "^3.15.1",
"typescript": "~2.3.4",
"webdriver-manager": "^12.0.6"
},
"repository": {}
}
and my protractor.conf.json
var fs = require('fs');
var path = require('canonical-path');
var _ = require('lodash');
exports.config = {
directConnect: true,
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
allScriptsTimeout:90000,
getPageTimeout:400000,
ignoreUncaughtExceptions: true,
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
// Spec patterns are relative to this config file
specs: ['**/cucumber_test/*.feature' ],
cucumberOpts: {
compiler: "ts:ts-node/register",
require: ['**/*e2e-spec.js'], // require step definition files before executing features
tags: '#TypeScriptScenario,#dev,#AddScenario,#SubtractScenario,#MultiplyScenario,#DivideScenario,#ModulusScenario', // <string[]> (expression) only execute the features or scenarios with tags matching the expression
strict: true, // <boolean> fail if there are any undefined or pending steps
format: ["pretty"], // <string[]> (type[:path]) specify the output format, optionally supply PATH to redirect formatter output (repeatable)
dryRun: false, // <boolean> invoke formatters without executing steps
'fail-fast': true
},
// For angular tests
useAllAngular2AppRoots: true,
// Base URL for application server
baseUrl: 'http://localhost:3000',
// doesn't seem to work.
// resultJsonOutputFile: "foo.json",
onPrepare: function() {
//// SpecReporter
//var SpecReporter = require('jasmine-spec-reporter');
//jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'none'}));
//// jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'}));
// debugging
// console.log('browser.params:' + JSON.stringify(browser.params));
/*jasmine.getEnv().addReporter(new Reporter( browser.params )) ;*/
// Allow changing bootstrap mode to NG1 for upgrade tests
global.setProtractorToNg1Mode = function() {
browser.useAllAngular2AppRoots = false;
browser.rootEl = 'body';
};
// browser.manage().window().maximize();
},
/*jasmineNodeOpts: {
// defaultTimeoutInterval: 60000,
defaultTimeoutInterval: 10000,
showTiming: true,
print: function() {}
}*/
}
This issue will be solved just downgrading the cucumber version 3 to 2.