Do Playwright support shared repo? - shared-libraries

Repo 1 --> Main repo, has all POM related things, More utility functions
Repo 2 --> Imported the Repo 1 and start writing the tests,
But i am keep getting the error from repo 1,
import { expect, Page } from "#playwright/test";
^^^^^^
SyntaxError: Cannot use import statement outside a module
But if i run the repo1 seperetely that run successfully but when integrate with repo 2 getting this error.
Any help will be really appreciated

Related

Cannot resolve dependency with within imported node module called "node-fetch"

Still somewhat of a beginner in Node, so apologies for what might be a newbie question. I have a small Chrome extension that I built where the only imported node module is one called node-fetch. I've never had trouble running yarn build to build a package that includes all the requisite dependencies. However, when I try to build my current package, yarn throws this error in the console:
🚨 /Users/me/Documents/GitHub/my-project/node_modules/node-fetch/src/index.js:9:17: Cannot resolve dependency 'node:http'
7 | */
8 |
> 9 | import http from 'node:http';
| ^
10 | import https from 'node:https';
11 | import zlib from 'node:zlib';
12 | import Stream, {PassThrough, pipeline as pump} from 'node:stream';
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "build:bg" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
So, this error is coming from the node_modules file myself rather than the code I wrote. Inside the package.json, I only declare this one dependency:
"dependencies": {
"node-fetch": "^3.3.0"
}
I tried manually installing the referenced packages and referencing them in the dependencies but to no avail.
What am I missing?
Tried to yarn build a package with a dependency on the node-fetch module that I import into my code. yarn throwing an error on the node-fetch module itself when I attempt to build.
Reverting to ^2.6.1 resolves the problem. Still interested to learn a better solve.

Having trouble consuming private NPM dependency from github

I am trying to consume a private React NPM package from my own github repo. I have successfully published to my github repo the package.
In the consumer project, I have sucessfully installed the package using the command my github/packages page provided. Command line tells me it has added the package.
I add to App.js:
import { HelloWorld } from '<the-same-package-name/inside-the-package.json>';
When I try to use the actual component, I keep getting the error:
Module not found: Error: Can't resolve '#my_github/private-repo' in <my local path>
does anyone have any idea what on earth I am doing wrong? I have the .npmrc set up in the same level as package.json with:
//npm.pkg.github.com/:_authToken=<my auth token with read privileges>
registry=https://npm.pkg.github.com/<my repo>
Is this a problem with exporting components from React? Am I not pulling in the component the correct way?
I have spent over an hour on this and just do not understand what part I am missing.

Unable to build Angular project in Alpine Linux

I've recently migrated my project to Angular 13. It builds locally on my Mac, however it's started to fail when I run it in my Docker build container (tested both locally and on our CI/CD server.
It's complaining about the DeckGL import:
Cannot find module '#deck.gl/layers' or its corresponding type declarations.
1 import * as Layers from '#deck.gl/layers';
Cannot find module '#deck.gl/geo-layers' or its corresponding type declarations.
2 import * as GeoLayers from '#deck.gl/geo-layers';
Cannot find module '#deck.gl/aggregation-layers' or its corresponding type declarations.
3 import * as AggregationLayers from '#deck.gl/aggregation-layers';
I've used npm list to ensure the dependencies are the same on my Mac and within the Alpine container and have also tested using the same Node version (and have tried a couple of different Node / Apline images), however, the issue persists, whilst still working locally.
Any ideas what could be causing this?
Really silly issue, but posting an answer in case someone runs into a similar issue in future.
I had accidentally run npm install in a top-level directory, and had installed some Node modules that didn't end up in my package.json file. In my case, I had the core deck.gl module installed in my package.json, but none of the layer packages (which are separate npm modules).
When I was running it locally, it was finding the correct dependency, but when running it on the CI/CD environment, it was obviously failing.

Babel Loader doesnt compile my own NPM package in react app

Ive only been learning Javascript/Typescript since the start of the year as I decided to create a group of microservices that are all linked together. I have my own API created in nestJS and found that whenever I wanted to call the API from each microservice i was repeating the same code over and over again so I moved it all into its own separate package which I can use.
Every other project I have which uses my npm package does not cause any errors and works fine however these projects are done using babel. I decided to implement my new package into my react frontend project but whenever I import the package and try to use it I get an error
SyntaxError: D:\Projects\Node\Lab Maker\redditbot-frontend\node_modules\labmaker-api-wrapper\lib\utils\BaseAPI.js: Missing class properties transform.
I managed to fix this issue by installing the babel class transform package but then was presented with another error.
Failed to compile.
./node_modules/labmaker-api-wrapper/lib/utils/BaseAPI.js 13:9
Module parse failed: Unexpected token (13:9)
File was processed with these loaders:
* ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|
| class API {
> APIBase;
| APIUrl = 'http://localhost:3000';
|
I'm not sure what is wrong with my package or what causes this error but if anyone is able to take a look at the source code for my npm module and explain how I would fix this issue that would be helpful. https://github.com/LabMaker/API-Wrapper
this is the npm package https://www.npmjs.com/package/labmaker-api-wrapper

cucumber-js parse error when run on Jenkins

I am trying to setup a jenkins pipeline step to runs some test scenarios using cucumber-js but I am getting an error back from the build as follows:
Error: Parse error in 'e2e/definitions/login.js': (1:1): expected:
#EOF, #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'const { Given, When, Then } = require('cucumber');'
The command being run in the pipeline step is as follows:
cucumber-js e2e/features/**/*.feature --require e2e/**/*.js
The opening lines of the login.js file the error is referencing are:
const { Given, When, Then } = require('cucumber');
const { Selector } = require('testcafe');
I'm wondering if this has something to do with nodejs version differences, as I am running 8.11.2 on my machine and dont see these errors, on Jenkins we are running 10.5.0
Does anyone know what the problem could be and point me in the right direction please?
Thanks
Likely you have this problem because the glob pattern specified after the --require pattern isn't resolved to real file names, but on your Jenkins it does. Try to wrap e2e/**/*.js in double quotes:
cucumber-js e2e/features/**/*.feature --require "e2e/**/*.js"
The error you're getting is a Gherkin parsing error, so I think cucumber is treating your step definition file as a Gherkin file (feature file). I would check which version of cucumber-js you're using locally versus the version that your using in CI. If the versions are different, your CI might be missing a bugfix or it might be using an different version of the CLI.
I also highly recommend setting up your local environment the same way as your CI (same version of node, pinned versions for your npm dependencies), it has saved me a lot of pain.

Resources